Skip to content

REGR: Series[dt64/td64].astype(string) #41958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 15, 2021

Conversation

jbrockmendel
Copy link
Member

This surfaces another bug in StringArray.__getitem__ that I haven't looked into yet.

@simonjayhawkins simonjayhawkins added this to the 1.3 milestone Jun 12, 2021
@simonjayhawkins simonjayhawkins added the Regression Functionality that used to work in a prior pandas version label Jun 12, 2021
@@ -712,6 +712,14 @@ cpdef ndarray[object] ensure_string_array(
Py_ssize_t i = 0, n = len(arr)

if hasattr(arr, "to_numpy"):

if hasattr(arr, "dtype") and arr.dtype.kind in ["m", "M"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, yeah the .to_numpy() on an EA is the approparate here.

@@ -660,6 +656,15 @@ def test_astype_dt64_to_string(self, frame_or_series, tz_naive_fixture, request)
alt = obj.astype(str)
assert np.all(alt.iloc[1:] == result.iloc[1:])

def test_astype_td64_to_string(self, frame_or_series):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you parametersize over td, dt, dt w/tz & period

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not nicely; the dt64 one uses tz_naive_fixture

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok can you add that as another test then. just to make sure coverng the bases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add what as another case? we have the td64 case here and the dt64 case right above here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh ok.

period covered? if not pls add (followup ok)

@@ -660,6 +656,15 @@ def test_astype_dt64_to_string(self, frame_or_series, tz_naive_fixture, request)
alt = obj.astype(str)
assert np.all(alt.iloc[1:] == result.iloc[1:])

def test_astype_td64_to_string(self, frame_or_series):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok can you add that as another test then. just to make sure coverng the bases.

@@ -716,6 +716,14 @@ cpdef ndarray[object] ensure_string_array(
Py_ssize_t i = 0, n = len(arr)

if hasattr(arr, "to_numpy"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont' have access to the ExtnsionTypes here right? so this is just as easy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

@jreback
Copy link
Contributor

jreback commented Jun 15, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jun 15, 2021

Something went wrong ... Please have a look at my logs.

@jbrockmendel jbrockmendel deleted the regr-41409 branch June 15, 2021 21:43
jreback pushed a commit that referenced this pull request Jun 15, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REGR: Change to Series[dt64/td64].astype("string")` behavior on master
3 participants