Skip to content

Commit

Permalink
Use pickle compat
Browse files Browse the repository at this point in the history
  • Loading branch information
lithomas1 committed Dec 4, 2023
1 parent 9df6e14 commit 1b2f1c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pandas/compat/pickle_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def load_reduce(self) -> None:
("pandas.core.sparse.array", "SparseArray"): ("pandas.core.arrays", "SparseArray"),
# 15477
("pandas.core.base", "FrozenNDArray"): ("numpy", "ndarray"),
# Re-routing unpickle block logic to go through _unpickle_block instead
# for pandas <= 1.3.5
("pandas.core.internals.blocks", "new_block"): (
"pandas._libs.internals",
"_unpickle_block",
),
("pandas.core.indexes.frozen", "FrozenNDArray"): ("numpy", "ndarray"),
("pandas.core.base", "FrozenList"): ("pandas.core.indexes.frozen", "FrozenList"),
# 10890
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2612,10 +2612,6 @@ def new_block(
# - maybe_coerce_values already called/unnecessary
klass = get_block_type(values.dtype)

# Old pandas (<=1.3.0) will call this function with placements
# that aren't necessarily BlockPlacements when unpickling
if not isinstance(placement, BlockPlacement):
placement = BlockPlacement(placement)
return klass(values, ndim=ndim, placement=placement, refs=refs)


Expand Down

0 comments on commit 1b2f1c3

Please sign in to comment.