Basic descriptive statistics with NumPy
In this book, we will try to use as many varied datasets as possible. This depends on the availability of the data. Unfortunately, this means that the subject of the data might not exactly match your interests. Every dataset has its own quirks, but the general skills you acquire in this book should transfer to your own field. In this chapter, we will load datasets from the statsmodels
library into NumPy arrays in order to analyze the data.
Mauna Loa CO2 measurements is the first dataset we shall use from the statsmodels
datasets package. The following code loads the dataset and prints basics descriptive statistical values:
import numpy as np from scipy.stats import scoreatpercentile import pandas as pd data = pd.read_csv("co2.csv", index_col=0, parse_dates=True) co2 = np.array(data.co2) print("The statistical values for amounts of co2 in atmosphere: \n") print("Max method", co2.max()) print("Max function"...