-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
to_datetime can unexpectedly return numpy array instead of DatetimeIndex #23045
Comments
Can you try on master?
|
I also don't see it for 0.23.4 on my laptop, so it might also be related to other factors (eg numpy version, python version. I was using python 3.5 with numpy 1.13 for both master and 0.23.4) |
Sorry, I didn't specify it in the first place, but I was using python 2.7.12. I tested it on other machine (always with python 2.7.12) and had the same result. However, I haven't tested on master yet. INSTALLED VERSIONScommit: None |
I tried on master and I get yet another output (which however still doesn't match previous behaviour). BTW, everything works as expected on python 3. pd.to_datetime(good_input, errors='coerce')
Out[4]: DatetimeIndex(['NaT', '2013-06-07'], dtype='datetime64[ns]', freq=None)
pd.to_datetime(bad_input, errors='coerce')
Out[5]: Index([u'bad_format', u'2013-06-07'], dtype='object') INSTALLED VERSIONScommit: ca7d518 pandas: 0.24.0.dev0+717.gca7d518cb |
What's the difference? That it is unicode? Thanks for checking on the different python versions. So it is a python2.7 issue then. |
Ah, sorry, that is is an Index instead of array, I see. |
Closing since pandas no longer supports 2.7 and it's fixed on master. |
In pandas>=0.23.0
returns
while when using pandas==0.22.0 everything is fine and returns
More precisely, the behaviour of
pandas._libs.array_to_datetime
have been changed between 0.22.0 and 0.23.0:gives
Expected Output
the same as it was in pandas==0.22.0
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-1067-aws
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.23.4
pytest: None
pip: 18.0
setuptools: 39.1.0
Cython: 0.28.5
numpy: 1.15.1
scipy: 1.1.0
pyarrow: 0.7.1
xarray: None
IPython: 5.8.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.5
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.6.5
feather: None
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: 3.5.0
bs4: None
html5lib: 0.9999999
sqlalchemy: None
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: