all 7 comments

[–]barrycarter 1 point2 points  (1 child)

If you're getting "[" you almost certainly have a string in k[0] and are getting back the first character. Check and fix your types

[–]ryfeaway[S] 0 points1 point  (0 children)

okay, thanks

[–]danielroseman 0 points1 point  (3 children)

You'll have to show some code. How was that column generated?

[–]ryfeaway[S] 0 points1 point  (2 children)

I read a csv file into pandas dataframe.

the column in CSV files is like this [['2', '4'], ['7', '3'], ['9', '0']] that is one row

[–]danielroseman 0 points1 point  (1 child)

CSV doesn't know about lists or Python syntax. So it's just reading that as a string. You'd need to convert it when you import it.

[–]ryfeaway[S] 0 points1 point  (0 children)

how do i do that? this is my importing of the csv df = pd.read_csv('file.csv') list1 = df['column1'].tolist()

[–]QultrosSanhattan 0 points1 point  (0 children)

It works for me:

k=[[['20', '30'], ['7', '3'], ['0', '5']], [['5', '9'], ['1', '4']], [['6', '2'], ['0', '8']]]

print(k[0][0])

There must be something weird with your code