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.
dataframe.get_dtype_counts() function returns the counts of dtypes in the given object. It returns a pandas series object containing the counts of all data types present in the pandas object. It works with pandas series as well as dataframe.
Returns : value : Series : Counts of datatypes
For link to CSV file Used in Code, click here
Example #1: Use
get_dtype_counts() function to find the counts of datatype of a pandas dataframe object.
Now apply the
get_dtype_counts() function. Find out the frequency of occurrence of each data type in the dataframe.
Notice, the output is a pandas series object containing the count of each data types in the dataframe.
Example #2: Use
get_dtype_counts() function over a selected no. of columns of the data frame only.
Notice, the output is a pandas series object containing the count of each data types in the dataframe. We can verify all these results using this the
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.