Returns the column name of the dataframe.
Returns datatypes of each column of a dataframe.
size
Returns a total number of elements present in dataframe.
shape
Returns a tuple which gives the present number of rows and number of columns of a dataframe as an element.
ndim
Returns an integer value which represents the number of dimensions of a dataframe.
See the output of all the above attributes in running mode.
Checking for emptiness
empty
Returns a Boolean value which represents if the dataframe is empty or not. If it will return “True”, then dataframe is empty, otherwise, it is not empty.
Transposing a DataFrame
T
It transposes a dataframe, i.e., rows become columns and columns become rows.
Getting Count of non-NA values in dataframe
count()
It will return non-NA values for each COLUMNS. By default, it will take 0 as an argument.
count(1)
If we pass 1 as an argument, then instead of returning number of columns, it will return number of each rows along with index number,
Count with axis parameter
We can also explicitly specify an argument to count() as axis.
If we want to count columns value then pass argument like
If we want to count rows value then pass argument like
See the output of all the above count attribute in running mode,
CONCLUSION
Now, we have learned about the DataFrames attributes in Python and how we can easily access any information of DataFrame.
All the queries related to this article and sample files are always welcome. Thanks for reading.!!!