import pandas as pd import numpy as np !cat PreisMoatStanley_ScientificReports_3_1684_2013.dat | head -n 2 df = pd.read_csv('PreisMoatStanley_ScientificReports_3_1684_2013.dat', delimiter=' ') columns = ['Google Start Date', 'Google End Date', 'debt', 'DJIA Date', 'DJIA Closing Price'] df = df[columns] df.head() debt_from_study = df[['debt']] debt_from_study.index = df['Google End Date'] debt_from_study.index = debt_from_study.index.to_datetime() debt_from_study.head() debt_us_as_of_20130528 = pd.read_csv('debt_US_google_trend.csv', index_col='date') debt_us_as_of_20130528.index = debt_us_as_of_20130528.index.to_datetime() debt_us_as_of_20130528.head() debt_compare = pd.merge(debt_from_study, debt_us_as_of_20130528, left_index=True, right_index=True, how='outer') debt_compare.head() import matplotlib.pyplot as plt fig, ax = plt.subplots() ax2 = ax.twinx() debt_compare.debt_x.plot(ax=ax, style='b-') debt_compare.debt_y.plot(ax=ax2, style='r-', secondary_y=True)