本文整理汇总了Python中odps.df.DataFrame.filter_partition方法的典型用法代码示例。如果您正苦于以下问题:Python DataFrame.filter_partition方法的具体用法?Python DataFrame.filter_partition怎么用?Python DataFrame.filter_partition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odps.df.DataFrame
的用法示例。
在下文中一共展示了DataFrame.filter_partition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFilterPartition
# 需要导入模块: from odps.df import DataFrame [as 别名]
# 或者: from odps.df.DataFrame import filter_partition [as 别名]
def testFilterPartition(self):
self.assertRaises(ExpressionError, lambda: self.expr.filter_partition(None))
self.assertRaises(ExpressionError, lambda: self.expr.filter_partition('part1=a/part2=1,part1=b/part2=2'))
self.assertRaises(ExpressionError, lambda: self.expr2.filter_partition('part1/part2=1,part1=b/part2=2'))
filtered1 = self.expr2.filter_partition('part1=a/part2=1,part1=b/part2=2')
self.assertIsInstance(filtered1, FilterPartitionCollectionExpr)
self.assertEqual(filtered1.schema, self.expr.schema)
self.assertEqual(filtered1.predicate_string, 'part1=a/part2=1,part1=b/part2=2')
filtered2 = self.expr2.filter_partition('part1=a/part2=1,part1=b/part2=2', exclude=False)
self.assertIsInstance(filtered2, FilterCollectionExpr)
try:
import pandas as pd
from odps.df import DataFrame
pd_df = pd.DataFrame([['Col1', 1], ['Col2', 2]], columns=['Field1', 'Field2'])
df = DataFrame(pd_df)
self.assertRaises(ExpressionError, lambda: df.filter_partition('Fieldd2=2'))
except ImportError:
pass