replacing stop duration where "1" or "2"
pirsquared opened this issue · comments
Sean Smith commented
A very pandas-esque way to replace the "1"
or "2"
with np.nan
is to use the pandas.Series.mask
method.
ri.stop_duration.mask(ri.stop_duration.isin(['1', '2']), inplace=True)
ri.stop_duration.value_counts(dropna=False)
0-15 Min 69543
16-30 Min 13635
NaN 5335
30+ Min 3228
Name: stop_duration, dtype: int64
Kevin Markham commented
@pirsquared Neat! Thanks for sharing!