In [1]:
import pandas as pd
from beakerx import *

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

In [2]:
prices=pd.read_csv("data/price.csv", index_col=0, header=0, parse_dates=True)

In [3]:
SimpleTimePlot(prices, prices.keys())



In [4]:
from pyutil.timeseries.merge import *

In [5]:
ts = prices["A"]

In [6]:
ts.tail(5)


Out[6]:
2015-04-16    1198.56
2015-04-17    1204.27
2015-04-20    1195.88
2015-04-21    1202.34
2015-04-22    1200.59
Name: A, dtype: float64

In [7]:
to_date(ts).tail(5)


Out[7]:
2015-04-16    1198.56
2015-04-17    1204.27
2015-04-20    1195.88
2015-04-21    1202.34
2015-04-22    1200.59
Name: A, dtype: float64

In [8]:
to_datetime(ts).tail(5)


Out[8]:
2015-04-16    1198.56
2015-04-17    1204.27
2015-04-20    1195.88
2015-04-21    1202.34
2015-04-22    1200.59
Name: A, dtype: float64

In [9]:
first_index(ts)


Out[9]:
Timestamp('2013-01-01 00:00:00')

In [10]:
first_index(to_date(ts))


Out[10]:
datetime.date(2013, 1, 1)

In [11]:
last_index(to_date(ts))


Out[11]:
datetime.date(2015, 4, 22)

In [12]:
SimpleTimePlot(np.log(prices["A"]).diff().dropna().to_frame("returns"), ["returns"])



In [13]:
from pyutil.timeseries.signal import *

In [14]:
SimpleTimePlot(prices["A"].to_frame("price"), ["price"])