I simply want to read in a csv file like this.
import pandas as pd df = pd.read_csv('file_path', sep='t')
I checked several times that the data in the csv file is indeed separated by tabs.
There are 77 headers and 2000 rows of data so I would expect a dataframe with 77 columns. However, with this code I always get just one column, as the separator is not recognized.
Printing df.info shows:
IdtTimetFrequency1tFrequency2t... 0 0t7.8743792338371276t67.94875739289347t3.4... 1 1t9.1758372435569762t22.99984130859375t33.48... 2 2t33.4772915616035467t67.000503540039062t76.4... 3 3t46.7787502965927142t11.000503540039062t101.4... 4 4t266.0802050471305855t8.000503540039062t0.4...
[2000 rows x 1 columns]
Clearly this is not the intended result. I am working on a hp spectre laptop with python 3.11.7. If the same code is executed on other windows machines in the same environment, it works perfectly fine as expected, so I guess there is something wrong with my laptop. Does somebody know about this problem and how to fix it
Vivienne Augustin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.