Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
from pandas.io.formats import printing

if TYPE_CHECKING:
from collections.abc import MutableMapping

import pyarrow

from pandas._typing import (
Expand Down Expand Up @@ -218,6 +220,10 @@ def __eq__(self, other: object) -> bool:
return self.storage == other.storage and self.na_value is other.na_value
return False

def __setstate__(self, state: MutableMapping[str, Any]) -> None:
self.storage = state.pop("storage", "python")
self._na_value = state.pop("_na_value", libmissing.NA)

def __hash__(self) -> int:
# need to override __hash__ as well because of overriding __eq__
return super().__hash__()
Expand Down
Binary file not shown.
8 changes: 8 additions & 0 deletions pandas/tests/io/generate_legacy_storage_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def create_pickle_data():
"float": Index(np.arange(10, dtype=np.float64)),
"uint": Index(np.arange(10, dtype=np.uint64)),
"timedelta": timedelta_range("00:00:00", freq="30min", periods=10),
"string": Index(["foo", "bar", "baz", "qux", "quux"], dtype="string"),
}

index["range"] = RangeIndex(10)
Expand Down Expand Up @@ -185,6 +186,7 @@ def create_pickle_data():
"dt": Series(date_range("20130101", periods=5)),
"dt_tz": Series(date_range("20130101", periods=5, tz="US/Eastern")),
"period": Series([Period("2000Q1")] * 5),
"string": Series(["foo", "bar", "baz", "qux", "quux"], dtype="string"),
}

mixed_dup_df = DataFrame(data)
Expand Down Expand Up @@ -233,6 +235,12 @@ def create_pickle_data():
},
index=range(5),
),
"string": DataFrame(
{
"A": Series(["foo", "bar", "baz", "qux", "quux"], dtype="string"),
"B": Series(["one", "two", "one", "two", "three"], dtype="string"),
}
),
}

cat = {
Expand Down
Loading