Python | Pandas dataframe.count() Last Updated : 20 Nov, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Pandas dataframe.count() is used to count the no. of non-NA/null observations across the given axis. It works with non-floating type data as well. Syntax: DataFrame.count(axis=0, level=None, numeric_only=False) Parameters: axis : 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise level : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a DataFrame numeric_only : Include only float, int, boolean data Returns: count : Series (or DataFrame if level specified) Example #1: Use count() function to find the number of non-NA/null value across the row axis. Python3 1== # importing pandas as pd import pandas as pd # Creating a dataframe using dictionary df = pd.DataFrame({"A":[-5, 8, 12, None, 5, 3], "B":[-1, None, 6, 4, None, 3], "C:["sam", "haris", "alex", np.nan, "peter", "nathan"]}) # Printing the dataframe df Now find the count of non-NA value across the row axis Python3 1== # axis = 0 indicates row df.count(axis = 0) Output : Example #2: Use count() function to find the number of non-NA/null value across the column. Python3 1== # importing pandas as pd import pandas as pd # Creating a dataframe using dictionary df = pd.DataFrame({"A":[-5, 8, 12, None, 5, 3], "B":[-1, None, 6, 4, None, 3], "C:["sam", "haris", "alex", np.nan, "peter", "nathan"]}) # Find count of non-NA across the columns df.count(axis = 1) Output : Comment More infoAdvertise with us Next Article Dataframe Attributes in Python Pandas S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-dataFrame Pandas-DataFrame-Methods +1 More Practice Tags : python Similar Reads Python | Pandas dataframe.all() 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.all() method checks whether all elements are True, potentially over an axis. 3 min read Python | Pandas dataframe.get_dtype_counts() 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. Pandas dataframe.get_dtype_counts() function returns the counts of dtypes in the given 2 min read Python | Pandas dataframe.info() When working with data in Python understanding the structure and content of our dataset is important. The dataframe.info() method in Pandas helps us in providing a concise summary of our DataFrame and it quickly assesses its structure, identify issues like missing values and optimize memory usage.Ke 2 min read Python | Pandas dataframe.applymap() 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.applymap() method applies a function that accepts and returns a scalar to ev 2 min read Dataframe Attributes in Python Pandas In this article, we will discuss the different attributes of a dataframe. Attributes are the properties of a DataFrame that can be used to fetch data or any information related to a particular dataframe. The syntax of writing an attribute is: DataFrame_name.attribute These are the attributes of the 11 min read Count Values in Pandas Dataframe Counting values in Pandas dataframe is important for understanding the distribution of data, checking for missing values or summarizing data. In this article, we will learn various methods to count values in a Pandas DataFrameWe will be using below dataframe to learn about various methods:Pythonimpo 3 min read Like