VOOZH about

URL: https://www.geeksforgeeks.org/python/python-pandas-dataframe-keys/

⇱ Python | Pandas dataframe.keys() - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python | Pandas dataframe.keys()

Last Updated : 19 Nov, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas dataframe.keys() function returns the 'info axis' for the pandas object. If the pandas object is series then it returns index. If the pandas object is dataframe then it returns columns. If the pandas object is panel then it returns major_axis.
Syntax: DataFrame.keys()
For link to the CSV file, click here Example #1: Use keys() function to find the columns of a dataframe. 👁 Image
Output : 👁 Image
  Example #2: Use keys() function to find the index of the pandas series object. 👁 Image
Output : 👁 Image
Comment