def read_sm_csv(csv_fname):
"""
Parse the SuperMAG CSV format data record *csv_fname*. For each
station, store the information in pandas
:class:`DataFrame`. Return a mapping between the station
identifier and data frame.
"""
df = PD.read_csv(csv_fname,
header=0,
parse_dates=[0],
date_parser=lambda x: datetime.strptime(x, '%Y-%m-%d %H:%M:%S'),
index_col=0)
df_map = {name: group for name, group in df.groupby('IAGA')}
for df in df_map.itervalues():
del df['IAGA']
df.rename(columns={'N': 'B_N',
'E': 'B_E',
'Z': 'B_Z'},
inplace=True)
return df_map
评论列表
文章目录