8000 DOC: Add user_guide examples and docstring example for df.plot.box and df.plot.hist by charlesdong1991 · Pull Request #42520 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DOC: Add user_guide examples and docstring example for df.plot.box and df.plot.hist #42520

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

Merged
merged 17 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert change
  • Loading branch information
charlesdong1991 committed Jan 14, 2020
commit cd9e7ac3f31ffaf95cd628863df911dea9fa1248
3 changes: 1 addition & 2 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def pivot_table(

table = agged

# GH 17038, this check should only happen if index is specified
if table.index.nlevels > 1 and index:
if table.index.nlevels > 1:
# Related GH #17123
# If index_names are integers, determine whether the integers refer
# to the level position or name.
Expand Down
20 changes: 6 additions & 14 deletions pandas/tests/reshape/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,12 @@ def _check_output(
totals = table.loc[("All", ""), value_col]
assert totals == self.data[value_col].mean()

# no rows
rtable = self.data.pivot_table(
columns=["AA", "BB"], margins=True, aggfunc=np.mean
)
assert isinstance(rtable, Series)

table = self.data.pivot_table(index=["AA", "BB"], margins=True, aggfunc="mean")
for item in ["DD", "EE", "FF"]:
totals = table.loc[("All", ""), item]
Expand Down Expand Up @@ -966,20 +972,6 @@ def test_pivot_integer_columns(self):

tm.assert_frame_equal(table, table2, check_names=False)

@pytest.mark.parametrize("cols", [(1, 2), ("a", "b"), (1, "b"), ("a", 1)])
def test_pivot_table_multiindex_only(self, cols):
# GH 17038
df2 = DataFrame({cols[0]: [1, 2, 3], cols[1]: [1, 2, 3], "v": [4, 5, 6]})

result = df2.pivot_table(values="v", columns=cols)
expected = DataFrame(
[[4, 5, 6]],
columns=MultiIndex.from_tuples([(1, 1), (2, 2), (3, 3)], names=cols),
index=Index(["v"]),
)

tm.assert_frame_equal(result, expected)

def test_pivot_no_level_overlap(self):
# GH #1181

Expand Down
0