Pandas Set Index | pd.DataFrame.set_index()

Published: 31 July 2020
on channel: Greg Kamradt (Data Indy)
4,428
51

https://dataindependent.com/pandas/pa...

Sometimes your row numbers as your index just doesn't cut it and you need to pandas set index on your DataFrame.

You may want to replace your current index with another column in your DataFrame. No problem with pd.DataFrame.set_index()!

You're usually doing this when you want to set your index to a list of names, or unique ids. For example, you imported a CSV but forgot to set your index_col.


Watch video Pandas Set Index | pd.DataFrame.set_index() online without registration, duration hours minute second in high quality. This video was added by user Greg Kamradt (Data Indy) 31 July 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,42 once and liked it 5 people.