Articles → Pandas → Index and columns attribute in dataframe in pandas

Index and columns attribute in dataframe in pandas






Index




import pandas as pd

list = [[1,21,3], [4,5,6], [7, 8,9]]

df = pd.DataFrame(list, columns=['col1','col2','col3'])

df.index





Click to Enlarge


Columns




import pandas as pd

list = [[1,21,3], [4,5,6], [7, 8,9]]

df = pd.DataFrame(list, columns=['col1','col2','col3'])

df.columns





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, May 01, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250