Reputation: 196
I'm new to python and want to import some csv data with pandas. The data is seperated with tabs ('\t'). The CSV file has 35339 rows and 23 columns. The data read in over pandas works as expected but if I try to visualize the data it says that the read in data has only 35339 rows and 1 column. Even if the data seems to be extracted correctly in the console over the print command, it seems that only one column but all rows are exported.
I tried several different options on how to import data over pandas. I also just the csv reader but did not get the expected result.Here is a snapshot of the data.
import pandas as pd
import glob
for filename in glob.glob('*.csv'):
print(filename)
sensor_df = pd.read_csv(filename, sep='\t',low_memory=False)
print(sensor_df)
The output is
[35338 rows x 1 columns]
expected is
[35338 rows x 23 columns]
Upvotes: 0
Views: 644
Reputation: 11232
Try skiprows
, it looks like the first row is a comment about the separator.
sensor_df = pd.read_csv(filename, sep='\t', low_memory=False, skiprows=1)
Upvotes: 1