DataFrame.index | Row labels of DataFrame |
DataFrame.columns | Column labels of DataFrame |
DataFrame.axes | Label values of rows and columns in the DataFrame |
DataFrame.dtypes | Data types for each column of DataFrame |
DataFrame.size | Total number of elements in a DataFrame |
DataFrame.shape | Dimensions of DataFrame ( Number of rows, Number of columns ) |
DataFrame.ndim | No. of Dimensions ( 1D, 2D, 3D ) |
DataFrame.empty | Check whether DataFrame is empty or not |
DataFrame.T | Change the rows into columns and columns into rows |
DataFrame.values | Values of DataFrame in the form of NumPy array |
print(df.index)
# By default it automatically creates a RangeIndex(start=0, stop=len(df), step=1)
# We can manually add index by passing list to index parameter i.e. index = [1, 2, 3]
# We can also set some existing column as an index i.e index = 'City'
print(df.columns)
print(df.axes)
print(df.dtypes)
print(df.size)
# Dimensions of the dataframe:
print(df.shape)
# Extract only the total number of rows in a dataframe:
print(df.shape[0])
# Extract only the total number of columns in a dataframe:
print(df.shape[1])
print(df.ndim)
print(df.empty)
print(df.T)
print(df.values)