Skip to content

Commit bcfaeed

Browse files
committed
arrays/period: allow parsing of PeriodDtype columns from read_csv
Fixes: #26934 Signed-off-by: Antonio Gutierrez <[email protected]>
1 parent 269d368 commit bcfaeed

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pandas/core/arrays/period.py

+4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ def _from_sequence(
253253
ordinals = libperiod.extract_ordinals(periods, freq)
254254
return cls(ordinals, freq=freq)
255255

256+
@classmethod
257+
def _from_sequence_of_strings(cls, strings, dtype=None, copy=False):
258+
return cls._from_sequence(strings, dtype, copy)
259+
256260
@classmethod
257261
def _from_datetime64(cls, data, freq, tz=None):
258262
"""

pandas/tests/extension/test_period.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,4 @@ class TestPrinting(BasePeriodTests, base.BasePrintingTests):
158158
class TestParsing(BasePeriodTests, base.BaseParsingTests):
159159
@pytest.mark.parametrize("engine", ["c", "python"])
160160
def test_EA_types(self, engine, data):
161-
expected_msg = r".*must implement _from_sequence_of_strings.*"
162-
with pytest.raises(NotImplementedError, match=expected_msg):
163-
super().test_EA_types(engine, data)
161+
super().test_EA_types(engine, data)

0 commit comments

Comments
 (0)