Python pandas.core.frame.DataFrame.round() Examples
The following are 7
code examples of pandas.core.frame.DataFrame.round().
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.frame.DataFrame
, or try the search function
.
Example #1
Source File: series.py From recruit with Apache License 2.0 | 6 votes |
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns ------- Series object See Also -------- numpy.around DataFrame.round """ nv.validate_round(args, kwargs) result = com.values_from_object(self).round(decimals) result = self._constructor(result, index=self.index).__finalize__(self) return result
Example #2
Source File: series.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns ------- Series object See Also -------- numpy.around DataFrame.round """ nv.validate_round(args, kwargs) result = com.values_from_object(self).round(decimals) result = self._constructor(result, index=self.index).__finalize__(self) return result
Example #3
Source File: series.py From vnpy_crypto with MIT License | 5 votes |
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns ------- Series object See Also -------- numpy.around DataFrame.round """ nv.validate_round(args, kwargs) result = com._values_from_object(self).round(decimals) result = self._constructor(result, index=self.index).__finalize__(self) return result
Example #4
Source File: series.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns ------- Series object See Also -------- numpy.around DataFrame.round """ nv.validate_round(args, kwargs) result = _values_from_object(self).round(decimals) result = self._constructor(result, index=self.index).__finalize__(self) return result
Example #5
Source File: series.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns ------- Series object See Also -------- numpy.around DataFrame.round """ nv.validate_round(args, kwargs) result = _values_from_object(self).round(decimals) result = self._constructor(result, index=self.index).__finalize__(self) return result
Example #6
Source File: series.py From recruit with Apache License 2.0 | 4 votes |
def corr(self, other, method='pearson', min_periods=None): """ Compute correlation with `other` Series, excluding missing values. Parameters ---------- other : Series method : {'pearson', 'kendall', 'spearman'} or callable * pearson : standard correlation coefficient * kendall : Kendall Tau correlation coefficient * spearman : Spearman rank correlation * callable: callable with input two 1d ndarray and returning a float .. versionadded:: 0.24.0 min_periods : int, optional Minimum number of observations needed to have a valid result Returns ------- correlation : float Examples -------- >>> histogram_intersection = lambda a, b: np.minimum(a, b ... ).sum().round(decimals=1) >>> s1 = pd.Series([.2, .0, .6, .2]) >>> s2 = pd.Series([.3, .6, .0, .1]) >>> s1.corr(s2, method=histogram_intersection) 0.3 """ this, other = self.align(other, join='inner', copy=False) if len(this) == 0: return np.nan if method in ['pearson', 'spearman', 'kendall'] or callable(method): return nanops.nancorr(this.values, other.values, method=method, min_periods=min_periods) raise ValueError("method must be either 'pearson', " "'spearman', or 'kendall', '{method}' " "was supplied".format(method=method))
Example #7
Source File: series.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 4 votes |
def corr(self, other, method='pearson', min_periods=None): """ Compute correlation with `other` Series, excluding missing values. Parameters ---------- other : Series method : {'pearson', 'kendall', 'spearman'} or callable * pearson : standard correlation coefficient * kendall : Kendall Tau correlation coefficient * spearman : Spearman rank correlation * callable: callable with input two 1d ndarray and returning a float .. versionadded:: 0.24.0 min_periods : int, optional Minimum number of observations needed to have a valid result Returns ------- correlation : float Examples -------- >>> histogram_intersection = lambda a, b: np.minimum(a, b ... ).sum().round(decimals=1) >>> s1 = pd.Series([.2, .0, .6, .2]) >>> s2 = pd.Series([.3, .6, .0, .1]) >>> s1.corr(s2, method=histogram_intersection) 0.3 """ this, other = self.align(other, join='inner', copy=False) if len(this) == 0: return np.nan if method in ['pearson', 'spearman', 'kendall'] or callable(method): return nanops.nancorr(this.values, other.values, method=method, min_periods=min_periods) raise ValueError("method must be either 'pearson', " "'spearman', or 'kendall', '{method}' " "was supplied".format(method=method))