Skip to content

Commit

Permalink
DEPR: remove pyarrow/fastparquet deprecations from pandas-dev#19265, p…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Jun 30, 2019
1 parent b491329 commit afa7611
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
23 changes: 3 additions & 20 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,12 @@ def make_block(self, values, placement=None, ndim=None):

return make_block(values, placement=placement, ndim=ndim)

def make_block_same_class(self, values, placement=None, ndim=None,
dtype=None):
def make_block_same_class(self, values, placement=None, ndim=None):
""" Wrap given values in a block of same type as self. """
if dtype is not None:
# issue 19431 fastparquet is passing this
warnings.warn("dtype argument is deprecated, will be removed "
"in a future release.", FutureWarning)
if placement is None:
placement = self.mgr_locs
return make_block(values, placement=placement, ndim=ndim,
klass=self.__class__, dtype=dtype)
klass=self.__class__)

def __repr__(self):
# don't want to print out all of the items here
Expand Down Expand Up @@ -2246,13 +2241,6 @@ def is_view(self):
# check the ndarray values of the DatetimeIndex values
return self.values._data.base is not None

def copy(self, deep=True):
""" copy constructor """
values = self.values
if deep:
values = values.copy()
return self.make_block_same_class(values)

def get_values(self, dtype=None):
"""
Returns an ndarray of values.
Expand Down Expand Up @@ -3041,8 +3029,7 @@ def get_block_type(values, dtype=None):
return cls


def make_block(values, placement, klass=None, ndim=None, dtype=None,
fastpath=None):
def make_block(values, placement, klass=None, ndim=None, dtype=None):
# Ensure that we don't allow PandasArray / PandasDtype in internals.
# For now, blocks should be backed by ndarrays when possible.
if isinstance(values, ABCPandasArray):
Expand All @@ -3053,10 +3040,6 @@ def make_block(values, placement, klass=None, ndim=None, dtype=None,
if isinstance(dtype, PandasDtype):
dtype = dtype.numpy_dtype

if fastpath is not None:
# GH#19265 pyarrow is passing this
warnings.warn("fastpath argument is deprecated, will be removed "
"in a future release.", FutureWarning)
if klass is None:
dtype = dtype or values.dtype
klass = get_block_type(values, dtype)
Expand Down
16 changes: 0 additions & 16 deletions pandas/tests/internals/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,6 @@ def test_delete(self):
with pytest.raises(Exception):
newb.delete(3)

def test_make_block_same_class(self):
# issue 19431
block = create_block('M8[ns, US/Eastern]', [3])
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
block.make_block_same_class(block.values,
dtype=block.values.dtype)


class TestDatetimeBlock:

Expand Down Expand Up @@ -1251,14 +1243,6 @@ def test_holder(typestr, holder):
assert blk._holder is holder


def test_deprecated_fastpath():
# GH#19265
values = np.random.rand(3, 3)
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
make_block(values, placement=np.arange(3), fastpath=True)


def test_validate_ndim():
values = np.array([1.0, 2.0])
placement = slice(2)
Expand Down

0 comments on commit afa7611

Please sign in to comment.