The pandas header parameter tells read_csv how to interpret the input’s first lines: use a line as column names, or treat the input as having no header. section 3.13
Choose the setting according to the file’s structure:
- Omit header to let read_csv treat the first line as column names. section 3.13
- Use header=None when every line is data and the file supplies no column names. section 1.23 section 3.13
- Pass an integer when headers appear on a later line rather than the first. section 3.13
Reading a one-column data file
s = pd.read_csv('data/taxi-passenger-count.csv', header=None).squeeze() reads the first line as a passenger-count value rather than a column label, then squeeze converts the one-column data frame into a Series. section 1.23
s = pd.read_csv('data/taxi-passenger-count.csv',
header=None).squeeze()
Inspect the compact read_csv call that preserves every input line as data. section 1.23
