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

FIX-#7371: Fix inserting datelike values into a DataFrame #7372

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

noloerino
Copy link
Collaborator

What do these changes do?

When a new value is inserted into a frame, we call pandas.api.types.pandas_dtype(value) to extract the dtype of an object like a pandas Series or numpy array. After #7261, when a scalar value is passed, this usually raises a TypeError, so we construct a local pandas Series from the object and extract the dtype from there.

When the passed value is a date-like string, pandas will instead raise a ValueError because it tries to parse it as a numpy structured dtype. After this fix, we now catch ValueError in addition to TypeError to handle this case.

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves BUG: can't create a new column with string which looks like a date #7371
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

@noloerino noloerino force-pushed the joshi/7371-date-insert branch from e03d087 to 3f75b36 Compare August 26, 2024 16:00
@YarShev YarShev merged commit f70176a into modin-project:main Aug 28, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: can't create a new column with string which looks like a date
2 participants