Python pandas.core.series.Series.fillna() Examples
The following are 17
code examples of pandas.core.series.Series.fillna().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.core.series.Series
, or try the search function
.
Example #1
Source File: groupby.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def backfill(self, limit=None): """ Backward fill the values. Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.backfill DataFrame.backfill Series.fillna DataFrame.fillna """ return self._fill('bfill', limit=limit)
Example #2
Source File: groupby.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def _transform_fast(self, result, obj): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = (self.size().fillna(0) > 0).any() # for each col, reshape to to size of original frame # by take operation ids, _, ngroup = self.grouper.group_info output = [] for i, _ in enumerate(result.columns): res = algorithms.take_1d(result.iloc[:, i].values, ids) if cast: res = self._try_cast(res, obj.iloc[:, i]) output.append(res) return DataFrame._from_arrays(output, columns=result.columns, index=obj.index)
Example #3
Source File: groupby.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def _transform_fast(self, result, obj): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = (self.size().fillna(0) > 0).any() # for each col, reshape to to size of original frame # by take operation ids, _, ngroup = self.grouper.group_info output = [] for i, _ in enumerate(result.columns): res = algorithms.take_1d(result.iloc[:, i].values, ids) if cast: res = self._try_cast(res, obj.iloc[:, i]) output.append(res) return DataFrame._from_arrays(output, columns=result.columns, index=obj.index)
Example #4
Source File: groupby.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def pad(self, limit=None): """ Forward fill the values. Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.pad DataFrame.pad Series.fillna DataFrame.fillna """ return self._fill('ffill', limit=limit)
Example #5
Source File: groupby.py From vnpy_crypto with MIT License | 6 votes |
def backfill(self, limit=None): """ Backward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.backfill DataFrame.backfill Series.fillna DataFrame.fillna """ return self._fill('bfill', limit=limit)
Example #6
Source File: groupby.py From vnpy_crypto with MIT License | 6 votes |
def pad(self, limit=None): """ Forward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.pad DataFrame.pad Series.fillna DataFrame.fillna """ return self._fill('ffill', limit=limit)
Example #7
Source File: groupby.py From recruit with Apache License 2.0 | 6 votes |
def backfill(self, limit=None): """ Backward fill the values. Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.backfill DataFrame.backfill Series.fillna DataFrame.fillna """ return self._fill('bfill', limit=limit)
Example #8
Source File: groupby.py From recruit with Apache License 2.0 | 6 votes |
def pad(self, limit=None): """ Forward fill the values. Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.pad DataFrame.pad Series.fillna DataFrame.fillna """ return self._fill('ffill', limit=limit)
Example #9
Source File: groupby.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _transform_should_cast(self, func_nm): """ Parameters: ----------- func_nm: str The name of the aggregation function being performed Returns: -------- bool Whether transform should attempt to cast the result of aggregation """ return (self.size().fillna(0) > 0).any() and ( func_nm not in base.cython_cast_blacklist)
Example #10
Source File: groupby.py From vnpy_crypto with MIT License | 5 votes |
def _transform_should_cast(self, func_nm): """ Parameters: ----------- func_nm: str The name of the aggregation function being performed Returns: -------- bool Whether transform should attempt to cast the result of aggregation """ return (self.size().fillna(0) > 0).any() and (func_nm not in _cython_cast_blacklist)
Example #11
Source File: groupby.py From recruit with Apache License 2.0 | 5 votes |
def _transform_should_cast(self, func_nm): """ Parameters: ----------- func_nm: str The name of the aggregation function being performed Returns: -------- bool Whether transform should attempt to cast the result of aggregation """ return (self.size().fillna(0) > 0).any() and ( func_nm not in base.cython_cast_blacklist)
Example #12
Source File: groupby.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def pad(self, limit=None): """ Forward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.fillna DataFrame.fillna """ return self.apply(lambda x: x.ffill(limit=limit))
Example #13
Source File: groupby.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def backfill(self, limit=None): """ Backward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.fillna DataFrame.fillna """ return self.apply(lambda x: x.bfill(limit=limit))
Example #14
Source File: groupby.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _transform_fast(self, func): """ fast version of transform, only applicable to builtin/cythonizable functions """ if isinstance(func, compat.string_types): func = getattr(self, func) ids, _, ngroup = self.grouper.group_info cast = (self.size().fillna(0) > 0).any() out = algorithms.take_1d(func().values, ids) if cast: out = self._try_cast(out, self.obj) return Series(out, index=self.obj.index, name=self.obj.name)
Example #15
Source File: groupby.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def pad(self, limit=None): """ Forward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.fillna DataFrame.fillna """ return self.apply(lambda x: x.ffill(limit=limit))
Example #16
Source File: groupby.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def backfill(self, limit=None): """ Backward fill the values Parameters ---------- limit : integer, optional limit of how many values to fill See Also -------- Series.fillna DataFrame.fillna """ return self.apply(lambda x: x.bfill(limit=limit))
Example #17
Source File: groupby.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _transform_fast(self, func): """ fast version of transform, only applicable to builtin/cythonizable functions """ if isinstance(func, compat.string_types): func = getattr(self, func) ids, _, ngroup = self.grouper.group_info cast = (self.size().fillna(0) > 0).any() out = algorithms.take_1d(func().values, ids) if cast: out = self._try_cast(out, self.obj) return Series(out, index=self.obj.index, name=self.obj.name)