Created
July 3, 2018 16:22
-
-
Save mattharrison/7e78e7f7efc3e66312365e7774f5cc6d to your computer and use it in GitHub Desktop.
Load nino
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
| # 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