You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/work/mindsdb/mindsdb_main/venv/lib/python3.10/site-packages/type_infer/infer.py", line 135, in type_check_date
if dt.hour == 0 and dt.minute == 0 and dt.second == 0 and len(str(element)) <= 16:
File "/work/mindsdb/mindsdb_main/venv/lib/python3.10/site-packages/pandas/core/generic.py", line 5989, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'hour'
The text was updated successfully, but these errors were encountered:
The function type_check_date is intended to work with a single element, that is, non iterable objects.
This issue arises when calling the function with a pandas.Series (which is iterable), which is a perfectly valid use case for pandas.to_datetime() but makes the function crash as pandas.to_datetime() returns a pandas.Series when called with a pandas.Series as argument. This is in opposition to the intended functionality, which is to be called with a single element as argument.
The following code works as intended
import pandas as pd
import type_infer
df = pd.DataFrame([{'month': '2017-07-01'}, {'month': '2017-08-01'}, {'month': '2017-09-01'}])
for element in df['month']:
print(type_infer.infer.type_check_date(element))
which outputs (in ipython)
datetime
datetime
datetime
Shall the user require support to check the type of a pandas.Series using this function, please let me know :)
Steps to replicate
Raises:
The text was updated successfully, but these errors were encountered: