modin-project / modin

Modin: Scale your Pandas workflows by changing a single line of code
http://modin.readthedocs.io
Apache License 2.0
9.91k stars 653 forks source link

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

Closed noloerino closed 2 months ago

noloerino commented 3 months ago

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.