MCPcopy Create free account
hub / github.com/apache/arrow / test_convert_empty_table

Method test_convert_empty_table

python/pyarrow/tests/test_pandas.py:3255–3271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3253 _check_pandas_roundtrip(df2, as_batch=True, preserve_index=True)
3254
3255 def test_convert_empty_table(self):
3256 arr = pa.array([], type=pa.int64())
3257 empty_objects = pd.Series(np.array([], dtype=object))
3258 tm.assert_series_equal(arr.to_pandas(),
3259 pd.Series(np.array([], dtype=np.int64)))
3260 arr = pa.array([], type=pa.list_(pa.int64()))
3261 tm.assert_series_equal(arr.to_pandas(), empty_objects)
3262 arr = pa.array([], type=pa.struct([pa.field('a', pa.int64())]))
3263 tm.assert_series_equal(arr.to_pandas(), empty_objects)
3264
3265 arr = pa.array([], type=pa.string())
3266 if Version(pd.__version__) >= Version("3.0.0"):
3267 # PyArrow backed string dtype are set by default
3268 empty_str = pd.Series([], dtype=str)
3269 tm.assert_series_equal(arr.to_pandas(), empty_str)
3270 else:
3271 tm.assert_series_equal(arr.to_pandas(), empty_objects)
3272
3273 def test_non_natural_stride(self):
3274 """

Callers

nothing calls this directly

Calls 4

VersionClass · 0.90
arrayMethod · 0.45
fieldMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected