Skip to content

Commit

Permalink
Update make_block's warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloqeely committed Jun 6, 2024
1 parent 9f2d569 commit d5dbc26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pandas/core/internals/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import numpy as np

from pandas._libs.internals import BlockPlacement
from pandas.util._exceptions import Pandas40DeprecationWarning

from pandas.core.dtypes.common import pandas_dtype
from pandas.core.dtypes.dtypes import (
Expand Down Expand Up @@ -93,7 +94,7 @@ def make_block(
"make_block is deprecated and will be removed in a future version. "
"Use pd.api.internals.create_dataframe_from_blocks or "
"(recommended) higher-level public APIs instead.",
DeprecationWarning,
Pandas40DeprecationWarning,
stacklevel=2,
)

Expand Down
3 changes: 2 additions & 1 deletion pandas/io/feather_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import doc
from pandas.util._exceptions import Pandas40DeprecationWarning
from pandas.util._validators import check_dtype_backend

import pandas as pd
Expand Down Expand Up @@ -136,7 +137,7 @@ def read_feather(
warnings.filterwarnings(
"ignore",
"make_block is deprecated",
DeprecationWarning,
Pandas40DeprecationWarning,
)

return feather.read_feather(
Expand Down
5 changes: 3 additions & 2 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from pandas.compat._optional import import_optional_dependency
from pandas.errors import AbstractMethodError
from pandas.util._decorators import doc
from pandas.util._exceptions import Pandas40DeprecationWarning
from pandas.util._validators import check_dtype_backend

import pandas as pd
Expand Down Expand Up @@ -278,7 +279,7 @@ def read(
filterwarnings(
"ignore",
"make_block is deprecated",
DeprecationWarning,
Pandas40DeprecationWarning,
)
result = pa_table.to_pandas(**to_pandas_kwargs)

Expand Down Expand Up @@ -397,7 +398,7 @@ def read(
filterwarnings(
"ignore",
"make_block is deprecated",
DeprecationWarning,
Pandas40DeprecationWarning,
)
return parquet_file.to_pandas(
columns=columns, filters=filters, **kwargs
Expand Down
7 changes: 5 additions & 2 deletions pandas/io/parsers/arrow_parser_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
ParserError,
ParserWarning,
)
from pandas.util._exceptions import find_stack_level
from pandas.util._exceptions import (
Pandas40DeprecationWarning,
find_stack_level,
)

from pandas.core.dtypes.common import pandas_dtype
from pandas.core.dtypes.inference import is_integer
Expand Down Expand Up @@ -291,7 +294,7 @@ def read(self) -> DataFrame:
warnings.filterwarnings(
"ignore",
"make_block is deprecated",
DeprecationWarning,
Pandas40DeprecationWarning,
)
if dtype_backend == "pyarrow":
frame = table.to_pandas(types_mapper=pd.ArrowDtype)
Expand Down

0 comments on commit d5dbc26

Please sign in to comment.