本文整理汇总了Python中pandas.core.generic.NDFrame.reindex方法的典型用法代码示例。如果您正苦于以下问题:Python NDFrame.reindex方法的具体用法?Python NDFrame.reindex怎么用?Python NDFrame.reindex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.core.generic.NDFrame
的用法示例。
在下文中一共展示了NDFrame.reindex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: panel4d_reindex
# 需要导入模块: from pandas.core.generic import NDFrame [as 别名]
# 或者: from pandas.core.generic.NDFrame import reindex [as 别名]
def panel4d_reindex(self, labs=None, labels=None, items=None, major_axis=None,
minor_axis=None, axis=None, **kwargs):
# Hack for reindex_axis deprecation
# Ha, we used labels for two different things
# I think this will work still.
if labs is None:
args = ()
else:
args = (labs,)
kwargs_ = dict(labels=labels,
items=items,
major_axis=major_axis,
minor_axis=minor_axis,
axis=axis)
kwargs_ = {k: v for k, v in kwargs_.items() if v is not None}
# major = kwargs.pop("major", None)
# minor = kwargs.pop('minor', None)
# if major is not None:
# if kwargs.get("major_axis"):
# raise TypeError("Cannot specify both 'major' and 'major_axis'")
# kwargs_['major_axis'] = major
# if minor is not None:
# if kwargs.get("minor_axis"):
# raise TypeError("Cannot specify both 'minor' and 'minor_axis'")
# kwargs_['minor_axis'] = minor
if axis is not None:
kwargs_['axis'] = axis
axes = validate_axis_style_args(self, args, kwargs_, 'labs', 'reindex')
kwargs.update(axes)
return NDFrame.reindex(self, **kwargs)