Skip to content

Instantly share code, notes, and snippets.

@QuentinN42
Created September 17, 2020 20:12
Show Gist options
  • Save QuentinN42/f5f715439051b909511623bdc997203a to your computer and use it in GitHub Desktop.
Save QuentinN42/f5f715439051b909511623bdc997203a to your computer and use it in GitHub Desktop.
Added return is_integer(element) or is_float(element) to the IntBlock._can_hold_element method because an Block of ints can be replaced from int read https://github.com/pandas-dev/pandas/issues/35376 for more infos
Index: pandas/core/internals/blocks.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- pandas/core/internals/blocks.py (revision 1b2f1f47b90fe585b8a01705482b1193aa281393)
+++ pandas/core/internals/blocks.py (date 1600372421300)
@@ -38,6 +38,7 @@
is_extension_array_dtype,
is_float_dtype,
is_integer,
+ is_float,
is_integer_dtype,
is_interval_dtype,
is_list_like,
@@ -2066,7 +2067,7 @@
and not issubclass(tipo.type, (np.datetime64, np.timedelta64))
and self.dtype.itemsize >= tipo.itemsize
)
- return is_integer(element)
+ return is_integer(element) or is_float(element)
class DatetimeLikeBlockMixin:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment