4
4
import pandas as pd
5
5
import pandas ._testing as tm
6
6
7
+ pytestmark = pytest .mark .filterwarnings (
8
+ "ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
9
+ )
10
+
7
11
pa = pytest .importorskip ("pyarrow" )
8
12
9
13
from pandas .core .arrays .arrow ._arrow_utils import pyarrow_array_to_numpy_and_mask
@@ -36,9 +40,7 @@ def test_arrow_roundtrip(data):
36
40
table = pa .table (df )
37
41
assert table .field ("a" ).type == str (data .dtype .numpy_dtype )
38
42
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 ()
42
44
assert result ["a" ].dtype == data .dtype
43
45
tm .assert_frame_equal (result , df )
44
46
@@ -56,9 +58,7 @@ def types_mapper(arrow_type):
56
58
record_batch = pa .RecordBatch .from_arrays (
57
59
[bools_array , ints_array , small_ints_array ], ["bools" , "ints" , "small_ints" ]
58
60
)
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 )
62
62
bools = pd .Series ([True , None , False ], dtype = "boolean" )
63
63
ints = pd .Series ([1 , None , 2 ], dtype = "Int64" )
64
64
small_ints = pd .Series ([- 1 , 0 , 7 ], dtype = "Int64" )
@@ -75,9 +75,7 @@ def test_arrow_load_from_zero_chunks(data):
75
75
table = pa .table (
76
76
[pa .chunked_array ([], type = table .field ("a" ).type )], schema = table .schema
77
77
)
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 ()
81
79
assert result ["a" ].dtype == data .dtype
82
80
tm .assert_frame_equal (result , df )
83
81
@@ -98,18 +96,14 @@ def test_arrow_sliced(data):
98
96
99
97
df = pd .DataFrame ({"a" : data })
100
98
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 ()
104
100
expected = df .iloc [2 :].reset_index (drop = True )
105
101
tm .assert_frame_equal (result , expected )
106
102
107
103
# no missing values
108
104
df2 = df .fillna (data [0 ])
109
105
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 ()
113
107
expected = df2 .iloc [2 :].reset_index (drop = True )
114
108
tm .assert_frame_equal (result , expected )
115
109
0 commit comments