From a2540364b85da8cdd82ec835cca3728e74f812db Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Wed, 9 Jan 2019 20:05:40 -0800 Subject: [PATCH 1/2] remove unused kwarg --- pandas/core/internals/blocks.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 70e4f44cb5de8..a6ae7a6ff8367 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -534,7 +534,7 @@ def astype(self, dtype, copy=False, errors='raise', values=None, **kwargs): **kwargs) def _astype(self, dtype, copy=False, errors='raise', values=None, - klass=None, **kwargs): + **kwargs): """Coerce to the new type Parameters @@ -599,14 +599,13 @@ def _astype(self, dtype, copy=False, errors='raise', values=None, return self.copy() return self - if klass is None: - if is_sparse(self.values): - # special case sparse, Series[Sparse].astype(object) is sparse - klass = ExtensionBlock - elif is_object_dtype(dtype): - klass = ObjectBlock - elif is_extension_array_dtype(dtype): - klass = ExtensionBlock + if is_sparse(self.values): + # special case sparse, Series[Sparse].astype(object) is sparse + klass = ExtensionBlock + elif is_object_dtype(dtype): + klass = ObjectBlock + elif is_extension_array_dtype(dtype): + klass = ExtensionBlock try: # force the copy here From a70990d28d07accbb50010d2f7c972c14432c2c7 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Thu, 10 Jan 2019 07:13:05 -0800 Subject: [PATCH 2/2] fixup --- pandas/core/internals/blocks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index a6ae7a6ff8367..e7c851c256081 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -599,6 +599,7 @@ def _astype(self, dtype, copy=False, errors='raise', values=None, return self.copy() return self + klass = None if is_sparse(self.values): # special case sparse, Series[Sparse].astype(object) is sparse klass = ExtensionBlock