-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: make_block #57754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPR: make_block #57754
Changes from 10 commits
956dd1a
c2754af
9055cbb
36e0d94
f6bc5f4
985f451
0a63a21
207bdc6
825e132
e3a3378
8e56e11
f3ac2b7
d0b7aa1
87ac3f0
b56ad16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,10 +10,12 @@ | |||||
from __future__ import annotations | ||||||
|
||||||
from typing import TYPE_CHECKING | ||||||
import warnings | ||||||
|
||||||
import numpy as np | ||||||
|
||||||
from pandas._libs.internals import BlockPlacement | ||||||
from pandas.util._exceptions import find_stack_level | ||||||
|
||||||
from pandas.core.dtypes.common import pandas_dtype | ||||||
from pandas.core.dtypes.dtypes import ( | ||||||
|
@@ -87,6 +89,14 @@ def make_block( | |||||
- Block.make_block_same_class | ||||||
- Block.__init__ | ||||||
""" | ||||||
warnings.warn( | ||||||
# GH#56815 | ||||||
"make_block is deprecated and will be removed in a future version. " | ||||||
"Use public APIs instead.", | ||||||
DeprecationWarning, | ||||||
stacklevel=find_stack_level(), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
|
||||||
if dtype is not None: | ||||||
dtype = pandas_dtype(dtype) | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
TYPE_CHECKING, | ||
Any, | ||
) | ||
import warnings | ||
|
||
from pandas._config import using_pyarrow_string_dtype | ||
|
||
|
@@ -123,9 +124,16 @@ def read_feather( | |
path, "rb", storage_options=storage_options, is_text=False | ||
) as handles: | ||
if dtype_backend is lib.no_default and not using_pyarrow_string_dtype(): | ||
return feather.read_feather( | ||
handles.handle, columns=columns, use_threads=bool(use_threads) | ||
) | ||
with warnings.catch_warnings(): | ||
warnings.filterwarnings( | ||
"ignore", | ||
"make_block is deprecated", | ||
DeprecationWarning, | ||
) | ||
|
||
return feather.read_feather( | ||
handles.handle, columns=columns, use_threads=bool(use_threads) | ||
) | ||
Comment on lines
+135
to
+144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this? (the fix is in a released pyarrow, so with latest of both you won't see any warning. Although of course when testing with an older pyarrow you will see it, but I am not sure we added such warning suppressions for other deprecations like DataFrame(mgr)?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we dont need it, no. we need to catch this either here or filterwarnings in a bunch of test places. so i prefer to catch it one place, but OK either way |
||
|
||
pa_table = feather.read_table( | ||
handles.handle, columns=columns, use_threads=bool(use_threads) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to point to the new
pd.api.internals.create_dataframe_from_blocks
? I know we don't want to encourage that, but TBH I assume this is used by few libraries for a specific reason anyway (exactly the use case for which the pd.api.internals can be used for), and the docstring of that function also asks the user to raise an issue about it