I've searched at other questions related to dropping rows but could not find one that worked:
I have a CSV file exported from the tool screaming frog that looks like this:
Internal - HTML | | |
--------------- | --------------|-------------|
Address | Content | Status Code |
----------------|---------------|-------------|
www.example.com | text/html | 200 |
I want to remove the first row that contains 'Internal - HTML'. When analyzing it with df.keys()
I get this information" Index(['Internal - HTML'], dtype='object')
.
I want to use the second row as the Index, which contains the correct column labels.
When I use the code:
a = pandas.read_csv("internal_html.csv", encoding="utf-8")
a.drop('Internal - HTML')
a.head(3)
I get this error: KeyError: 'Internal - HTML'
I also tried what was suggested here Remove index name in pandas and also tried resetting the index:
a = pandas.read_csv("internal_html.csv", encoding="utf-8")
a.reset_index(level=0, drop=True)
a.head(3)
None of the options above worked.