In this article, we will discuss how to use `describe()`

function to obtain only the mean and standard deviation values.

## Selecting the mean and std parameters

To obtain only the mean and standard deviation values, we can pass a list of parameters to the `describe()`

function. The list should include only the parameters we are interested in. In this case, we are interested in the mean and standard deviation parameters. Therefore, we can pass the list `['mean', 'std']`

to the `describe()`

function. The syntax for using the `describe()`

function with only the mean and standard deviation parameters is shown below.

` ````
```df.describe(include=['mean', 'std'])

In the above code snippet, `df`

represents the DataFrame for which we want to obtain the mean and standard deviation values. The `include`

parameter is set to a list of parameters that includes only the mean and standard deviation.

## Example: Use describe() in Pandas to Only Calculate Mean and Std

In Pandas, the `describe()`

function provides a summary of a DataFrame or Series, which includes the count, mean, standard deviation, minimum, maximum, and quartiles of the data. However, sometimes we might only be interested in calculating the mean and standard deviation. In this case, we can use the `describe()`

function with the `include`

parameter to specify only the columns we want to include in the summary.

Here is an example:

` ````
```import pandas as pd
data = {'A': [1, 2, 3, 4, 5], 'B': [6, 7, 8, 9, 10]}
df = pd.DataFrame(data)
# Only include columns A and B in the summary
summary = df.describe(include=['A', 'B'])[['mean', 'std']]
print(summary)

Output:

` ````
```# A B
# mean 3.000000 8.000000
# std 1.581139 1.581139

As we can see, the `describe()`

function provides a summary of only columns A and B, and we have used the double bracket notation to select only the `mean`

and `std`

columns.

By using the `include`

parameter and selecting only the columns we need, we can avoid cluttering the summary with unnecessary information and focus on the statistics that matter to us. This can make it easier to gain insights into the data and make informed decisions based on the results.

## Wrap up

To learn more about the Pandas `describe()`

method, check out the:

https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.describe.html

Thanks for reading. Happy coding!