44import pandas as pd
55import pandas ._testing as tm
66
7+ pytestmark = pytest .mark .filterwarnings (
8+ "ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
9+ )
10+
711pa = pytest .importorskip ("pyarrow" )
812
913from pandas .core .arrays .arrow ._arrow_utils import pyarrow_array_to_numpy_and_mask
@@ -36,9 +40,7 @@ def test_arrow_roundtrip(data):
3640 table = pa .table (df )
3741 assert table .field ("a" ).type == str (data .dtype .numpy_dtype )
3842
39- msg = "Passing a BlockManager to DataFrame is deprecated"
40- with tm .assert_produces_warning (DeprecationWarning , match = msg ):
41- result = table .to_pandas ()
43+ result = table .to_pandas ()
4244 assert result ["a" ].dtype == data .dtype
4345 tm .assert_frame_equal (result , df )
4446
@@ -56,9 +58,7 @@ def types_mapper(arrow_type):
5658 record_batch = pa .RecordBatch .from_arrays (
5759 [bools_array , ints_array , small_ints_array ], ["bools" , "ints" , "small_ints" ]
5860 )
59- msg = "Passing a BlockManager to DataFrame is deprecated"
60- with tm .assert_produces_warning (DeprecationWarning , match = msg ):
61- result = record_batch .to_pandas (types_mapper = types_mapper )
61+ result = record_batch .to_pandas (types_mapper = types_mapper )
6262 bools = pd .Series ([True , None , False ], dtype = "boolean" )
6363 ints = pd .Series ([1 , None , 2 ], dtype = "Int64" )
6464 small_ints = pd .Series ([- 1 , 0 , 7 ], dtype = "Int64" )
@@ -75,9 +75,7 @@ def test_arrow_load_from_zero_chunks(data):
7575 table = pa .table (
7676 [pa .chunked_array ([], type = table .field ("a" ).type )], schema = table .schema
7777 )
78- msg = "Passing a BlockManager to DataFrame is deprecated"
79- with tm .assert_produces_warning (DeprecationWarning , match = msg ):
80- result = table .to_pandas ()
78+ result = table .to_pandas ()
8179 assert result ["a" ].dtype == data .dtype
8280 tm .assert_frame_equal (result , df )
8381
@@ -98,18 +96,14 @@ def test_arrow_sliced(data):
9896
9997 df = pd .DataFrame ({"a" : data })
10098 table = pa .table (df )
101- msg = "Passing a BlockManager to DataFrame is deprecated"
102- with tm .assert_produces_warning (DeprecationWarning , match = msg ):
103- result = table .slice (2 , None ).to_pandas ()
99+ result = table .slice (2 , None ).to_pandas ()
104100 expected = df .iloc [2 :].reset_index (drop = True )
105101 tm .assert_frame_equal (result , expected )
106102
107103 # no missing values
108104 df2 = df .fillna (data [0 ])
109105 table = pa .table (df2 )
110- msg = "Passing a BlockManager to DataFrame is deprecated"
111- with tm .assert_produces_warning (DeprecationWarning , match = msg ):
112- result = table .slice (2 , None ).to_pandas ()
106+ result = table .slice (2 , None ).to_pandas ()
113107 expected = df2 .iloc [2 :].reset_index (drop = True )
114108 tm .assert_frame_equal (result , expected )
115109
0 commit comments