本文整理汇总了Python中pandas.util.testing.makeBoolIndex方法的典型用法代码示例。如果您正苦于以下问题:Python testing.makeBoolIndex方法的具体用法?Python testing.makeBoolIndex怎么用?Python testing.makeBoolIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.util.testing
的用法示例。
在下文中一共展示了testing.makeBoolIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_objs
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import makeBoolIndex [as 别名]
def get_objs():
indexes = [
tm.makeBoolIndex(10, name='a'),
tm.makeIntIndex(10, name='a'),
tm.makeFloatIndex(10, name='a'),
tm.makeDateIndex(10, name='a'),
tm.makeDateIndex(10, name='a').tz_localize(tz='US/Eastern'),
tm.makePeriodIndex(10, name='a'),
tm.makeStringIndex(10, name='a'),
tm.makeUnicodeIndex(10, name='a')
]
arr = np.random.randn(10)
series = [Series(arr, index=idx, name='a') for idx in indexes]
objs = indexes + series
return objs
示例2: setup_method
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import makeBoolIndex [as 别名]
def setup_method(self, method):
self.bool_index = tm.makeBoolIndex(10, name='a')
self.int_index = tm.makeIntIndex(10, name='a')
self.float_index = tm.makeFloatIndex(10, name='a')
self.dt_index = tm.makeDateIndex(10, name='a')
self.dt_tz_index = tm.makeDateIndex(10, name='a').tz_localize(
tz='US/Eastern')
self.period_index = tm.makePeriodIndex(10, name='a')
self.string_index = tm.makeStringIndex(10, name='a')
self.unicode_index = tm.makeUnicodeIndex(10, name='a')
arr = np.random.randn(10)
self.int_series = Series(arr, index=self.int_index, name='a')
self.float_series = Series(arr, index=self.float_index, name='a')
self.dt_series = Series(arr, index=self.dt_index, name='a')
self.dt_tz_series = self.dt_tz_index.to_series(keep_tz=True)
self.period_series = Series(arr, index=self.period_index, name='a')
self.string_series = Series(arr, index=self.string_index, name='a')
types = ['bool', 'int', 'float', 'dt', 'dt_tz', 'period', 'string',
'unicode']
fmts = ["{0}_{1}".format(t, f)
for t in types for f in ['index', 'series']]
self.objs = [getattr(self, f)
for f in fmts if getattr(self, f, None) is not None]
示例3: setup_method
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import makeBoolIndex [as 别名]
def setup_method(self, method):
self.bool_index = tm.makeBoolIndex(10, name='a')
self.int_index = tm.makeIntIndex(10, name='a')
self.float_index = tm.makeFloatIndex(10, name='a')
self.dt_index = tm.makeDateIndex(10, name='a')
self.dt_tz_index = tm.makeDateIndex(10, name='a').tz_localize(
tz='US/Eastern')
self.period_index = tm.makePeriodIndex(10, name='a')
self.string_index = tm.makeStringIndex(10, name='a')
self.unicode_index = tm.makeUnicodeIndex(10, name='a')
arr = np.random.randn(10)
self.bool_series = Series(arr, index=self.bool_index, name='a')
self.int_series = Series(arr, index=self.int_index, name='a')
self.float_series = Series(arr, index=self.float_index, name='a')
self.dt_series = Series(arr, index=self.dt_index, name='a')
self.dt_tz_series = self.dt_tz_index.to_series(keep_tz=True)
self.period_series = Series(arr, index=self.period_index, name='a')
self.string_series = Series(arr, index=self.string_index, name='a')
self.unicode_series = Series(arr, index=self.unicode_index, name='a')
types = ['bool', 'int', 'float', 'dt', 'dt_tz', 'period', 'string',
'unicode']
self.indexes = [getattr(self, '{}_index'.format(t)) for t in types]
self.series = [getattr(self, '{}_series'.format(t)) for t in types]
self.objs = self.indexes + self.series