Row index

If a file has one more column of data than the number of column names, the first column will be used as the DataFrame's row names:

data = 'a,b,c
4,apple,bat,5.7
8,orange,cow,10'
pd.read_csv(StringIO(data), index_col=0)

We get the following output:

The column with values but no corresponding column name is used as a row index.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset