import pandas.io.data as web from datetime import datetime import pandas as pd ticker = 'HMC' start = datetime(2014, 1, 1) end = datetime(2014, 12, 19) df=web.DataReader(ticker, 'yahoo', start, end) df.reset_index(level=0, inplace=True) # R's data frame doesn't like it when the index is a date so convert date to column df.head() %load_ext rpy2.ipython %R -i df %%R -w 480 -h 300 -u px # instead of px, you can also choose 'in', 'cm', or 'mm' df = as.data.frame(df) # ensure dataframe that was passed in from Python will be R's dataframe type library(ggplot2) p = ggplot(df, aes(df$Date, df$Adj.Close)) p = p + geom_line() + ggtitle("HMC Closing Price") + xlab("Date") + ylab("Price") print(p) %%R library(forecast) HoltWinters(df$Adj.Close) %%R hwm = HoltWinters(df$Adj.Close, gamma=FALSE) hwf = forecast.HoltWinters(hwm, h=20) summary(hwf) %R print(summary(hwf)) %R print(head(df)) %%R plot.forecast(hwf)