Pandas is a great python module for data manipulation. There are many functions in it that make your task easy. The * pandas.DataFrame.describe()* is one of them and it allows you to generate descriptive statistics like mean, max, min, std (standard deviation) e.t.c. In this entire tutorial, you will learn to implement the pandas dataframe describe() method with examples.

## Examples of Pandas Dataframe Describe

In this section, you will know all the examples on how to get statistics of dataframe and series using the * describe()* method.

### Example 1: Applying Pandas Dataframe Describe on Series

In this example, first you will create a series and apply describe() method to it. You can create series using the * Series()* method. Execute the below lines of code.

```
import pandas as pd
series = pd.Series([10,20,30,40,50,60])
print(series.describe())
```

**Output**

You can see I have got all the statistics values like min, count, std, max e.t.c.

### Example 2: Apply Pandas Describe on Categorical Series

Now suppose you have categorical data or Series and want to describe it. Then also you can use the * describe() *function. You can find count, unique, frequency of value e.t.c using it. Run the below lines of code and see the output.

```
import pandas as pd
cat_series = pd.Series(["a","b","a","c","d","d","c"])
print(cat_series.describe())
```

**Output**

### Example 3: Apply Pandas Describe on Mix data (Numeric and Categorical)

In this example, I will create a Dataframe that has both numeric and categorical data columns. After that, I will use the panda’s * dataframe describe()* method to find the statistics on numeric, categorical, or whole data frame.

Let’s create a Sample Dataframe.

```
import pandas as pd
cat_data = pd.Categorical(["x","y","z"])
num_data = [10,20,30]
data = {"categorical_data_col":cat_data,"numeric_data_col":num_data}
df = pd.DataFrame(data)
print(df)
```

**Output**

#### Finding Statistics on Numeric Column

By default, if you apply * describe()* method then you will get statistics on the numeric column. You can also use the

*method to find statistics on numeric column.*

**df.column_name.describe()**Run the below lines of code and see the output.

`print(df.describe())`

**Output**

#### Finding Statistics on Categorical Column

To describe a categorical column you have to use the column name to do so. Execute the below lines of code.

`print(df.categorical_data_col.describe())`

**Output**

#### Describe all columns of the dataframe

You can also describe all columns of the dataframe bypassing * include=’all’* as an argument inside the describe() method.

`print(df.describe(include="all"))`

**Output**

## Conclusion

**Pandas Dataframe describe()** method is very useful in finding the statistics of numeric or categorical data quickly. In fact, It helps you manipulate or find patterns in the dataframe. These are the examples I have compiled for you. I hope this tutorial has cleared your queries on it. Even if you have doubts then you can contact us for more help.

Source:

#### Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.