0

I have a CSV file in which one column is a list of tuples. But when I am reading it in python the list of tuples is read as a string object.

1 Answer 1

1

Read csv using pandas, using following function

pandas.read_csv()

It will read list as string. To convert it into list use following function

import ast

ast.literal_eval()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.