Skip to content

Instantly share code, notes, and snippets.

@samchaaa
Created April 11, 2019 14:51
Show Gist options
  • Save samchaaa/4ba43aaf52edc3ce9acf4028a05c3ac2 to your computer and use it in GitHub Desktop.
Save samchaaa/4ba43aaf52edc3ce9acf4028a05c3ac2 to your computer and use it in GitHub Desktop.
import pandas as pd
oc = pd.DataFrame([line.strip('\n').split(',') for line in open('../../Downloads/quotedata.dat')])
oc.head()
oc.columns = oc.loc[2, :]
oc = oc.loc[3:]
oc['Calls K'] = oc.apply(lambda x: float(x['Calls'][-6:-2])/10, axis=1)
oc['Puts K'] = oc.apply(lambda x: float(x['Puts'][-6:-2])/10, axis=1)
sorted(oc['Calls K'].unique())
sorted(oc['Puts K'].unique())
oc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment