Skip to content

Commit d063cbc

Browse files
committed
[python][RDF] Add tests for creating an RDataFrame from an empty array
1 parent e1f393c commit d063cbc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bindings/pyroot/pythonizations/test/rdataframe_makenumpy.py

+10
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ def test_sliced_array(self):
154154
self.assertEqual(list(x_col.GetValue()), [1,3])
155155
self.assertEqual(list(y_col.GetValue()), [2,4])
156156

157+
def test_empty_arrays(self):
158+
"""
159+
Test creating an RDataFrame from an empty numpy array
160+
"""
161+
data = {"x": np.array([], dtype="object")}
162+
df = ROOT.RDF.FromNumpy(data)
163+
colnames = df.GetColumnNames()
164+
self.assertIn("x", colnames)
165+
self.assertEqual(df.Count().GetValue(), 0)
166+
157167

158168
if __name__ == '__main__':
159169
unittest.main()

0 commit comments

Comments
 (0)