I have a multi-level pandas dataframe which im trying to level. I use reset_index but its giving me error that the name already exist.
I dont want to use reset_index(drop=True)
because i want to keep one of the column names still.
i want as my new dataframe:
country,listing_neighborhood,count
right now,
df.columns
only gives count
.
my code:
df.columns = ['count']
df.reset_index() -> gives error that `ValueError: cannot insert country, already exists`
I also tried:
df.columns.droplevel(0)
-> gives error that 'Index' object has no attribute 'droplevel'