My dataframe has many lists. When try to plot them, I found that each got a parentheses at both ends. How to remove it and convert them to a normal string.
My code:
df =
xdat ydat
0 [0.5,2.2,3.4] [4.5,9.2,1.4]
1 [2.5,3.2,3.6] [7.5,6.2,4.4]
2 [4.5,2.9,3.7] [8.5,3.2,8.4]
for i,r in df.iterrows():
print(type(r['xdat'])
#plt.plot(r['xdat'],r['ydat'])
#plt.show()
Present output:
<class 'str'>
<class 'str'>
<class 'str'>
I found that each list got parentheses at both ends as given below when I tried to plot them. But, the original data frame has no parentheses at both ends.
'[0.5,2.2,3.4]'
So, how to remove the unwanted parentheses seen at both ends of the list?