简体   繁体   中英

How do it set up automatic DataFrame structure when I scan the data in Excel to python?

My data in Excel is not separated by ",". Twitter data separated by columns. When I throw it in Python, it automatically installs DataFrame and Tweets are not showed full text. How can I overcome this?

enter image description here

If you have a copy open in Excel, the easiest solution would be to save a copy as a csv. File -> Save As -> dropdown and select CSV. But pandas also allows you to read excel files. This would be recommended if you have a lot of files and don't want to convert all of them.

df = pd.read_excel(<file>)

Now, if you're saying it isn't .xlsx and also not .csv, but you know the delimiter , then:

df = pd.read_csv(<file>, delimiter='\t')  # for tab delimited, but you can change '\t' to any delimiter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM