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

TST: tests for inconsistent indexing with datetimes #20550

Merged
merged 5 commits into from
May 29, 2018

Conversation

jcontesti
Copy link
Contributor

@codecov
Copy link

codecov bot commented Mar 30, 2018

Codecov Report

Merging #20550 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20550      +/-   ##
==========================================
+ Coverage   91.84%   91.84%   +<.01%     
==========================================
  Files         153      153              
  Lines       49499    49505       +6     
==========================================
+ Hits        45460    45466       +6     
  Misses       4039     4039
Flag Coverage Δ
#multiple 90.23% <ø> (ø) ⬆️
#single 41.88% <ø> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/multi.py 94.99% <0%> (-0.09%) ⬇️
pandas/core/frame.py 97.22% <0%> (-0.01%) ⬇️
pandas/core/accessor.py 98.71% <0%> (ø) ⬆️
pandas/core/indexes/interval.py 93.14% <0%> (ø) ⬆️
pandas/core/series.py 94.12% <0%> (ø) ⬆️
pandas/core/indexes/base.py 96.68% <0%> (+0.04%) ⬆️
pandas/core/common.py 92.09% <0%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc37ea2...f7fb642. Read the comment docs.

@@ -427,6 +427,13 @@ def test_loc_setitem_consistency(self):
expected = DataFrame({'date': Series(['string'])})
tm.assert_frame_equal(df, expected)

Copy link
Contributor

Choose a reason for hiding this comment

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

can you move this to pandas/tests/frame/test_indexing.py

make it a new test. (with _datetime in the name). can you add all of the examples in the original post?

@jreback jreback added Testing pandas testing functions or related to the test suite Indexing Related to indexing on series/frames, not to indexes themselves Dtype Conversions Unexpected or buggy dtype conversions labels Mar 30, 2018
@jreback jreback changed the title TST: test added to GH9336 TST: tests or inconsistent indexing with datetimes Mar 30, 2018
@jreback
Copy link
Contributor

jreback commented Mar 30, 2018

also add as a comment the original issue number

@jreback jreback changed the title TST: tests or inconsistent indexing with datetimes TST: tests for inconsistent indexing with datetimes Mar 30, 2018
@jcontesti
Copy link
Contributor Author

Done, happy to contribute! Please, let me know if I must make any additional changes.

@jreback jreback added this to the 0.24.0 milestone May 23, 2018
'y',
pd.datetime(2013, 1, 1),
pd.datetime(2014, 1, 1)]})
df = pd.DataFrame(np.zeros((6, 2), dtype=int), columns=['a', 'b'])
Copy link
Contributor

Choose a reason for hiding this comment

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

this is failing because you are specify the dtype directly I think, just use
pd.DataFrame(0, columns = list('ab'), index=range(6))

df.loc[[2, 3], 'b'] = 'x', 'y'
A = pd.DataFrame([[13, pd.datetime(2013, 1, 1)],
[14, pd.datetime(2014, 1, 1)]])
df.loc[[4, 5], ['a', 'b']] = A.values
Copy link
Contributor

Choose a reason for hiding this comment

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

can you assign with a numpy array that you construct directly

@jcontesti
Copy link
Contributor Author

Done! :-)

@jreback jreback merged commit f0c2330 into pandas-dev:master May 29, 2018
@jreback
Copy link
Contributor

jreback commented May 29, 2018

thanks @jcontesti

david-liu-brattle-1 pushed a commit to david-liu-brattle-1/pandas that referenced this pull request Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem mixing datetime64 with other types in DataFrame column
2 participants