pandas.DataFrame.replace¶
- DataFrame.replace(to_replace, value=None, method='pad', axis=0, inplace=False, limit=None)¶
Replace values given in ‘to_replace’ with ‘value’ or using ‘method’
- value : scalar or dict, default None
- Value to use to fill holes (e.g. 0), alternately a dict of values specifying which value to use for each column (columns not in the dict will not be filled)
- method : {‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}, default ‘pad’
- Method to use for filling holes in reindexed Series pad / ffill: propagate last valid observation forward to next valid backfill / bfill: use NEXT valid observation to fill gap
- axis : {0, 1}, default 0
- 0: fill column-by-column 1: fill row-by-row
- inplace : boolean, default False
- If True, fill the DataFrame in place. Note: this will modify any other views on this DataFrame, like if you took a no-copy slice of an existing DataFrame, for example a column in a DataFrame. Returns a reference to the filled object, which is self if inplace=True
- limit : int, default None
- Maximum size gap to forward or backward fill
reindex, asfreq
filled : DataFrame