-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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: Inconsistent datetime comparison with Tz #12601
Comments
I opened numpy/numpy#7390 Does this belong to |
this is an invalid dtype for numpy and not defined there |
@jreback I'm validating that the |
use numpy doesn't know about/respect this (its really a bug in the dtype definition and i don't know when/if ever will be fixed/allowed). |
Here is also the method to coerce. EDT is not a timezone, and what
|
Thank you for the pointers. In [4]: df = pd.DataFrame([parse("Mar 10, 2016 11:20 PM EDT")], columns=['ts'])
In [16]: df['ts'] = pd.to_datetime(df['ts']).astype('datetime64[us, US/Eastern]')
In [19]: df.dtypes['ts'] == np.dtype('datetime64[ns]')
Out[19]: False So how am I to compare? Thanks |
what are you trying to do? why do you need to compare? what are you comparing? most ops will simply work, you rarely actually need to compare things, if you need to sub-select use |
Sorry, I didn't offer context. I came across this working unit tests for pydata/pandas-datareader#188 dtypes = [np.dtype(x) for x in ['float64', 'float64', 'datetime64[ns]']]
tm.assert_series_equal(df.dtypes, pd.Series(dtypes, index=exp_columns)) I had to force no timezone for the compare above to succeed ... |
@gliptak I don't quite understood also. pydata/pandas-datareader#188 is merged and the test has been passed. Pls update pydata/pandas-datareader#188 if there is any problem. I assume this issue is unrelated to yours. |
Related to #8306. On current master,
Timestamp
comparison results inTypeError
if its timezones are different. However,Index
andSeries
implicitly converts tz to GMTNumeric ops raises
TypeError
as expected.The text was updated successfully, but these errors were encountered: