Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mattharrison/7e78e7f7efc3e66312365e7774f5cc6d to your computer and use it in GitHub Desktop.

Select an option

Save mattharrison/7e78e7f7efc3e66312365e7774f5cc6d to your computer and use it in GitHub Desktop.
Load nino
# Data transformation from previous notebook
# col names in tao-all2.col from website
names = '''obs
year
month
day
date
latitude
longitude
zon.winds
mer.winds
humidity
air temp.
s.s.temp.'''.split('\n')
nino = pd.read_csv('data/tao-all2.dat.gz', sep=' ', names=names, na_values='.',
parse_dates=[[1,2,3]])
nino.columns = [x.replace('.', '_').replace(' ', '_') for x in nino.columns]
nino['air_temp_F'] = nino.air_temp_ * 9/5 + 32
wind_cols = [x for x in nino.columns if x.endswith('winds')]
for c in wind_cols:
nino['{}_mph'.format(c)] = nino[c] * 2.237
pd.to_datetime(nino.date, format='%y%m%d')
nino = nino.drop('obs', axis=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment