Added: descriptive statistics in python (#27678)

* Added: descriptive statistics in python

* fix: adjusted formatting, added some descriptive text
This commit is contained in:
Suwash Chandra Acharya
2018-12-18 13:55:49 +11:00
committed by Christopher McCormack
parent 5dd935a310
commit 0d4a3090c0

View File

@ -56,7 +56,7 @@ df.describe()
``` ```
This will show the `count`, `mean`, `std`, `min`, `max` among others for numeric data. This will show the `count`, `mean`, `std`, `min`, `max` among others for numeric data.
## Subsetting ### Subsetting
A data frame can be subset in many ways. One of the simplest is getting a single column. For instance, if the data frame `df` contains a column named `age`, we can extract it as follows: A data frame can be subset in many ways. One of the simplest is getting a single column. For instance, if the data frame `df` contains a column named `age`, we can extract it as follows:
```python ```python
ages = df["age"] ages = df["age"]
@ -74,6 +74,14 @@ Another option for subsetting a dataframe is using the loc and iloc methods. The
ages = df.loc["age"] ages = df.loc["age"]
``` ```
### Basic Statistics
Descriptive statistics can be performed on each column of a pandas dataframe.
Get the mean of the values for the requested axis
```python
mean = df.mean()
```
#### More Information: #### More Information:
1. [pandas](http://pandas.pydata.org/) 1. [pandas](http://pandas.pydata.org/)
2. [read_csv](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html?highlight=read_csv#pandas.read_csv) 2. [read_csv](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html?highlight=read_csv#pandas.read_csv)