Import libs¶
First let’s import both pandas and numpy.
import pandas as pd
import numpy as npThe read_csv method will read in a CSV file and returns to us a DataFrame
One dimention array¶
sr = pd.Series([1, 3, 5, np.nan, 6, 8])
sr0 1.0
1 3.0
2 5.0
3 NaN
4 6.0
5 8.0
dtype: float64type(sr)pandas.core.series.Seriessr.describe()count 5.000000
mean 4.600000
std 2.701851
min 1.000000
25% 3.000000
50% 5.000000
75% 6.000000
max 8.000000
dtype: float64sr.to_numpy()array([ 1., 3., 5., nan, 6., 8.])Two dimention array¶
dates = pd.date_range("20130101", periods=6)
datesDatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04',
'2013-01-05', '2013-01-06'],
dtype='datetime64[ns]', freq='D')Read more from here