Created
June 5, 2018 17:29
-
-
Save mattharrison/0e162315c216ef8f57afd833bba8e5a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%time | |
cols = ['obs', 'year', 'month', 'day', 'date', 'latitude', 'longitude', | |
'zon.winds', 'mer.winds', 'humidity', 'air temp.', 's.s.temp.'] | |
nino = pd.read_csv('data/tao-all2.dat.gz', sep=' ', names=cols, header=None, | |
na_values='.', parse_dates=[[1,2,3]]) | |
cols = [c.strip().rstrip('.').replace(' ', '_').replace('.', '_') | |
for c in nino.columns] | |
nino.columns = cols | |
nino.date = pd.to_datetime(nino.date, format='%y%m%d') | |
nino['zon_winds_mph'] = nino.zon_winds * 2.237 | |
nino['mer_winds_mph'] = nino.mer_winds * 2.237 | |
nino['s_s_temp_F'] = nino.s_s_temp *9/5 + 32 | |
nino['air_temp_F'] = nino.air_temp *9/5 + 32 | |
nino = nino.drop('obs', axis=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment