How to view a Python object DataFrame all index, column names, and DataFrame specific value?

How to view a Python object DataFrame all index, column names, and DataFrame specific value?

There is now a dataframe objects df1, view the index that use df1.index, see the column name to use df1.columns, to see all the value df1.values.

In the code seen here:

df1=pd.DataFrame(np.arange(16).reshape(4,4),
                 index = pd.date_range('20200101', periods = 4),  
                 columns=list('ABCD'))
print(df1)

Df1 state of the output is as follows:

1. View index: df1.index. Output:

2. Check all the column names: df1.columns, output:

Index(['A', 'B', 'C', 'D'], dtype='object')

3. Check the value dataframe using df1.values, returns a matrix:

4. Note that the use df1.index returns an index, if for specific value, the required conversion of df1.index.values ​​list.

 

 

Published 26 original articles · won praise 4 · Views 1457

Guess you like

Origin blog.csdn.net/lost0910/article/details/104657040