I am a newbie in Python.
Say I have the following very simple table saved in a text file:
one two three
four five six
seven eight nine
I can view this table using pandas:
import pandas as pd
df = pd.read_csv('table.txt')
print(df)
The outcome of this is:
one two three
0 four five six
1 seven eight nine
Now, I want to delete the first row (i.e. one two three
). My first thought was to write:
df.drop([0])
Because rows and columns are numbered starting from 0. But what this does is that it drops the second row (i.e. four five six
).
Thus the title of this question. How to remove a row that has no index number? Because as seen from print(df)
, the first row is not given an index.
I did try to Google this, but I was not able to find an answer. This is probably because I do not know some keywords.