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

Fixes: [#60084] Added a new file test_timestamp_hash.py #60115

Closed
wants to merge 1 commit into from

Conversation

vgauraha62
Copy link

This pull request addresses the problem described in..

logging.info("Timestamps are equal")

# Important to Convert to UTC before comparing hash values to avoid Daylight Saving Time (DST) issues
ts1_utc = ts1.tz_convert('UTC')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to UTC before comparing the hashes doesn't replicate the behavior I reported--the bug is one of those "DST issues" that UTC avoids 😄. The reported issue is that the hashes of the original ts1 and ts2 instances, without normalization, don't have the same hash though they compare equal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i read through it again. maybe i should stop normalizing timestamps to UTC, and start comparing the hash values in their original timezones.

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review https://pandas.pydata.org/docs/development/contributing_codebase.html#test-driven-development on how to pandas prefers its unit tests. This test should be able to be located in an existing file.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Oct 30, 2024
@KevsterAmp
Copy link
Contributor

This PR seems to have gone stale. I'll take over this issue thanks!

@mroeschke
Copy link
Member

Closing as the parent issue was closed

@mroeschke mroeschke closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: arithmetic can break equality-hash invariant for Timestamp during DST transition
4 participants