本文整理汇总了Python中km3pipe.dataclasses.Table.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Table.merge方法的具体用法?Python Table.merge怎么用?Python Table.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类km3pipe.dataclasses.Table
的用法示例。
在下文中一共展示了Table.merge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge_different_columns_with_no_nan_compatible_dtype_even_if_fillna
# 需要导入模块: from km3pipe.dataclasses import Table [as 别名]
# 或者: from km3pipe.dataclasses.Table import merge [as 别名]
def test_merge_different_columns_with_no_nan_compatible_dtype_even_if_fillna(
self
):
tab1 = Table({'a': [1]}, h5loc='/a', h5singleton=True)
tab2 = Table({'b': [2]})
tab3 = Table({'c': [3]})
with self.assertRaises(ValueError):
merged_tab = Table.merge([tab1, tab2, tab3], fillna=True)
示例2: test_merge
# 需要导入模块: from km3pipe.dataclasses import Table [as 别名]
# 或者: from km3pipe.dataclasses.Table import merge [as 别名]
def test_merge(self):
tab1 = Table({'a': [1]}, h5loc='/a', h5singleton=True)
tab2 = Table({'a': [2]})
tab3 = Table({'a': [3]})
merged_tab = Table.merge([tab1, tab2, tab3])
assert 3 == len(merged_tab)
self.assertListEqual([1, 2, 3], list(merged_tab.a))
assert '/a' == merged_tab.h5loc
assert merged_tab.h5singleton
示例3: test_merge_other_different_columns_fills_nan_when_fillna
# 需要导入模块: from km3pipe.dataclasses import Table [as 别名]
# 或者: from km3pipe.dataclasses.Table import merge [as 别名]
def test_merge_other_different_columns_fills_nan_when_fillna(self):
tab1 = Table({'a': [1.1, 1.2], 'b': [10.1, 10.2]})
tab2 = Table({'a': [2.1, 2.2], 'c': [100.1, 100.2]})
merged_tab = Table.merge([tab1, tab2], fillna=True)
assert 4 == len(merged_tab)
self.assertListEqual([1.1, 1.2, 2.1, 2.2], list(merged_tab.a))
self.assertListEqual([10.1, 10.2], list(merged_tab.b[:2]))
self.assertListEqual([100.1, 100.2], list(merged_tab.c[2:]))
assert np.isnan(merged_tab.c[0])
assert np.isnan(merged_tab.c[1])
assert np.isnan(merged_tab.b[2])
assert np.isnan(merged_tab.b[3])
示例4: test_merge_different_columns_fills_nan_when_fillna
# 需要导入模块: from km3pipe.dataclasses import Table [as 别名]
# 或者: from km3pipe.dataclasses.Table import merge [as 别名]
def test_merge_different_columns_fills_nan_when_fillna(self):
tab1 = Table({'a': [1.1]}, h5loc='/a', h5singleton=True, split_h5=True)
tab2 = Table({'b': [2.2]})
tab3 = Table({'c': [3.3]})
merged_tab = Table.merge([tab1, tab2, tab3], fillna=True)
assert 3 == len(merged_tab)
assert 1.1 == merged_tab.a[0]
assert np.isnan(merged_tab.a[1])
assert np.isnan(merged_tab.a[2])
assert np.isnan(merged_tab.b[0])
assert 2.2 == merged_tab.b[1]
assert np.isnan(merged_tab.b[2])
assert np.isnan(merged_tab.c[0])
assert np.isnan(merged_tab.c[1])
assert 3.3 == merged_tab.c[2]
assert '/a' == merged_tab.h5loc
assert merged_tab.h5singleton
assert merged_tab.split_h5