Reputation: 481
I have the following CSV file:
I aim to show just the following columns: Date, Inbound and Outbound. For that, I'm using pandas
to get what I want.
My code is the following:
path_input = 'CSR1 - Traffic - 10.10.1.1 (Tunnel0).csv'
data = pd.read_csv(path_input,sep='\t')
data.columns = ["Date", "Inbound", "Outbound"]
I'm having this error:
----> 3 data.columns = ["Date", "Inbound", "Outbound"]
ValueError: Length mismatch: Expected axis has 1 elements, new values have 3 elements
Upvotes: 1
Views: 145
Reputation: 863156
It seems you need skip first rows:
data = pd.read_csv(path_input,sep='\t', skiprows=9)
Or specify row for new header, e.g. 10th
row:
data = pd.read_csv(path_input,sep='\t', header=[10])
Upvotes: 5