本文整理汇总了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