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: Add tests for old issues #41482

Merged
merged 10 commits into from
May 17, 2021
Merged

Conversation

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label May 15, 2021
@mroeschke mroeschke added this to the 1.3 milestone May 15, 2021
def test_drop_inplace_no_leftover_column_reference(self):
# GH 13934
df = DataFrame()
df["a"] = [1, 2, 3]
Copy link
Member

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()
Copy link
Member

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(
[
Copy link
Member

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"]
Copy link
Member

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?

Copy link
Member Author

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

@jreback jreback merged commit 62f102d into pandas-dev:master May 17, 2021
@jreback
Copy link
Contributor

jreback commented May 17, 2021

thanks @mroeschke

@mroeschke mroeschke deleted the testing/old_issues branch May 17, 2021 16:17
TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment