本文整理匯總了Python中pandas.Series.name方法的典型用法代碼示例。如果您正苦於以下問題:Python Series.name方法的具體用法?Python Series.name怎麽用?Python Series.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.Series
的用法示例。
在下文中一共展示了Series.name方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: describe
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def describe(self):
"""
Describes this Categorical
Returns
-------
description: `DataFrame`
A dataframe with frequency and counts by category.
"""
counts = self.value_counts(dropna=False)
freqs = counts / float(counts.sum())
from pandas.core.reshape.concat import concat
result = concat([counts, freqs], axis=1)
result.columns = ['counts', 'freqs']
result.index.name = 'categories'
return result
示例2: _reduce
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
filter_type=None, **kwds):
""" perform the reduction type operation if we can """
func = getattr(self, name, None)
if func is None:
raise TypeError("{klass} cannot perform the operation {op}".format(
klass=self.__class__.__name__, op=name))
return func(**kwds)
示例3: _reduce
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _reduce(self, name, axis=0, **kwargs):
func = getattr(self, name, None)
if func is None:
msg = 'Categorical cannot perform the operation {op}'
raise TypeError(msg.format(op=name))
return func(**kwargs)
示例4: __init__
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def __init__(self, data):
self._validate(data)
self._parent = data.values
self._index = data.index
self._name = data.name
self._freeze()
示例5: _delegate_property_get
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _delegate_property_get(self, name):
return getattr(self._parent, name)
示例6: _delegate_property_set
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _delegate_property_set(self, name, new_values):
return setattr(self._parent, name, new_values)
示例7: name
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def name(self):
# Note: Upon deprecation, `test_tab_completion_with_categorical` will
# need to be updated. `name` will need to be removed from
# `ok_for_cat`.
warn("`Series.cat.name` has been deprecated. Use `Series.name` "
"instead.",
FutureWarning,
stacklevel=2)
return self._name
示例8: _selection_name
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _selection_name(self):
"""
return a name for myself; this would ideally be called
the 'name' property, but we cannot conflict with the
Series.name property which can be set
"""
if self._selection is None:
return None # 'result'
else:
return self._selection
示例9: _reduce
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
filter_type=None, **kwds):
""" perform the reduction type operation if we can """
func = getattr(self, name, None)
if func is None:
raise TypeError("{klass} cannot perform the operation {op}".format(
klass=self.__class__.__name__, op=name))
return func(skipna=skipna, **kwds)
示例10: _dispatch
# 需要導入模塊: from pandas import Series [as 別名]
# 或者: from pandas.Series import name [as 別名]
def _dispatch(name, *args, **kwargs):
""" dispatch to apply """
def outer(self, *args, **kwargs):
def f(x):
x = self._shallow_copy(x, groupby=self._groupby)
return getattr(x, name)(*args, **kwargs)
return self._groupby.apply(f)
outer.__name__ = name
return outer