The keys() method

When used with a series, the keys() method returns the row-labels or index of the series and serves the same function it does when accessing the index attribute of a DataFrame or series. The keys() method shows different behaviors when used with a DataFrame and with a series; it returns the column labels when used on a DataFrame and the row index when used with a series:

In: sample_df["Wins"].keys()
Out: RangeIndex(start=0, stop=5, step=1)

In: sample_df.keys()
Out: Index(['Movie', 'Wins', 'Nominations'], dtype='object')
..................Content has been hidden....................

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