Skip to content
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

BUG: Series.str.__getitem__ in modin ends up with incorrect dtype if an invalid key was passed #5968

Open
3 tasks done
dchigarev opened this issue Apr 10, 2023 · 0 comments
Open
3 tasks done
Labels
bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests

Comments

@dchigarev
Copy link
Collaborator

dchigarev commented Apr 10, 2023

Modin version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest released version of Modin.

  • I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow this guide.)

Reproducible Example

import pandas
import modin.pandas as pd

pd_ser = pandas.Series(["a", "b"])
md_ser = pd.Series(["a", "b"])

md_res = md_ser.str[100] # will result into a series full of NaNs
pd_res = pd_ser.str[100] # will result into a series full of NaNs

print(f"modin dtypes:\n{md_res.dtypes}\n") # object
print(f"pandas dtypes:\n{pd_res.dtypes}\n") # float64

print(f"modin internal dtypes:\n{md_res._to_pandas().dtypes}") # float64 (doesn't match modin's cache)

Issue Description

When an invalid key is passed it results into a Series full of NaNs having float64 dtype. Modin on its turn doesn't have this logic of changing the dtype depending on the result and just copies them from the source frame:

str___getitem__ = Map.register(
_str_map("__getitem__"), dtypes="copy", shape_hint="column"
)

Expected Behavior

To work as pandas

Error Logs

Replace this line with the error backtrace (if applicable).

Installed Versions

Replace this line with the output of pd.show_versions()

--
Note: this issue is part of an epic #3804

@dchigarev dchigarev added bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests labels Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests
Projects
None yet
Development

No branches or pull requests

1 participant