Skip to content
Snippets Groups Projects

Remove deprecated pandas inplace keyword argument usage

Merged David Hoese requested to merge feature-remove-inplace into master
1 file
+ 7
9
Compare changes
  • Side-by-side
  • Inline
@@ -47,13 +47,11 @@ def _get_data(input_files, parser):
def get_data(input_files, parser):
frame = pd.DataFrame(_get_data(input_files, parser))
frame.set_index('TIMESTAMP', inplace=True)
frame = frame.set_index('TIMESTAMP')
# XXX: Do we need to check for -999 too?
frame.mask(frame == -99999., inplace=True)
frame.fillna(value=np.nan, inplace=True)
frame = frame.mask(frame == -99999.).fillna(value=np.nan)
# get rid of unused fields
frame.drop(columns=['RECORD', 'OSSignature', 'programversion'],
inplace=True)
frame = frame.drop(columns=['RECORD', 'OSSignature', 'programversion'])
return frame
@@ -184,8 +182,8 @@ def create_giant_netcdf(input_files, output_fn, zlib, chunk_size,
# drop unused variables
frame = filter_unused_columns(frame, database)
# rename columns to netcdf friendly names
frame.rename(lambda col_name: db_rename.get(col_name, col_name),
axis='columns', inplace=True)
frame = frame.rename(lambda col_name: db_rename.get(col_name, col_name),
axis='columns')
# Add wind direction components so we can average wind direction properly
frame['wind_east'], frame['wind_north'], _ = calc.wind_vector_components(frame['wind_speed'], frame['wind_dir'])
@@ -218,7 +216,7 @@ def create_giant_netcdf(input_files, output_fn, zlib, chunk_size,
frame['gust'] = new_frame['gust'].resample(interval_width, closed='right', loffset=interval_width).max()
del frame['wind_east']
del frame['wind_north']
frame.fillna(np.nan, inplace=True)
frame = frame.fillna(np.nan)
if start and end:
frame = frame[start.strftime('%Y-%m-%d %H:%M:%S'): end.strftime('%Y-%m-%d %H:%M:%S')]
@@ -257,7 +255,7 @@ def create_giant_netcdf(input_files, output_fn, zlib, chunk_size,
written_vars.extend(write_var(nc_file.variables, depths,
'depth', database, qc=False))
frame.drop(columns=all_water_depth_deps, inplace=True)
frame = frame.drop(columns=all_water_depth_deps)
written_vars.extend(write_vars(nc_file, frame, database, station_info))
unwritten_vars = set(nc_file.variables.keys()) - set(written_vars)
written_vars.extend(write_qc_for_unwritten(nc_file.variables,
Loading