October 2019
Beginner to intermediate
674 pages
16h 43m
English
In this section, we demonstrate the various ways to read in time series data, starting with the simple read_csv method:
In [7]: ibmData=pd.read_csv('ibm-common-stock-closing-prices-1959_1960.csv')
ibmData.head()
Out[7]: TradeDate closingPrice
0 1959-06-29 445
1 1959-06-30 448
2 1959-07-01 450
3 1959-07-02 447
4 1959-07-06 451
5 rows 2 columns
The source of this information can be found at http://datamarket.com.
We would like the TradeDate column to be a series of datetime values so that we can index it and create a time series:
Let's first check the type of values in the TradeDate series:
In [16]: type(ibmData['TradeDate']) Out[16]: pandas.core.series.Series In [12]: type(ibmData['TradeDate'][0]) Out[12]: ...
Read now
Unlock full access