-
-
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
TST: Add tests for old issues #41482
Conversation
mroeschke
commented
May 15, 2021
- closes BUG: duplicate indexing on non-integer index with positional indexers failing in py3 #13427
- closes BUG: Index set operations issues #13432
- closes Partial indexing with a list and hierarchical index #13501
- closes frame and columns can get out of sync #13569
- closes ERR: set errno in read_csv #13872
- closes BUG: Columns used in sum on 1 row dataframe depend on values instead of dtype #13912
- closes Column reappears after drop() when working on a reference of that column #13934
- closes BUG: unstack doesn't preserve categorical dtype #14018
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
def test_drop_inplace_no_leftover_column_reference(self): | ||
# GH 13934 | ||
df = DataFrame() | ||
df["a"] = [1, 2, 3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it important that this is set here instead of being part of the constructor?
def test_frame_mixed_numeric_object_with_timestamp(ts_value): | ||
# GH 13912 | ||
df = DataFrame({"a": [1], "b": [1.1], "c": ["foo"], "d": [ts_value]}) | ||
result = df.sum() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_frame_reductions i think
df = DataFrame({"cat": pd.Categorical(["a", "b"])}, index=idx) | ||
result = df.unstack() | ||
expected = DataFrame( | ||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pass this as a dict or use from_arrays? IIRC the constructor is wonky specifically if the first listlike is a categorical
frame.index.names = ["key1", "key2"] | ||
frame.columns.names = ["state", "color"] | ||
with pytest.raises(KeyError, match="\\[2\\] not in index"): | ||
frame.loc[["b", 2], "Colorado"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is bc the user passed a list instead of a tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, as a tuple I think this should correctly select
In [2]: frame
Out[2]:
state Ohio Colorado
color Green Red Green
key1 key2
a 1 0 1 2
2 3 4 5
b 1 6 7 8
2 9 10 11
In [3]: frame.loc[('b', 2), 'Colorado']
Out[3]:
color
Green 11
Name: (b, 2), dtype: int64
thanks @mroeschke |