Skip to content

Commit

Permalink
code sample for pandas-dev#38463
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Dec 14, 2020
1 parent 54829b7 commit 5328ffc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bisect/38463.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sys

import pandas as pd

print(pd.__version__)

df = pd.DataFrame(
[[1, 2], [3, 4], [5, 6]], index=pd.date_range("2020-01-30", "2020-02-01")
)

result = df.resample("1M").apply(lambda df: df.mean().mean())
print(result)

expected = pd.Series(
[2.5, 5.5],
index=pd.DatetimeIndex(
["2020-01-31", "2020-02-29"], dtype="datetime64[ns]", freq="M"
),
)

import pandas.testing as tm

try:
tm.assert_series_equal(result, expected)
except:
pass
else:
sys.exit(1)

0 comments on commit 5328ffc

Please sign in to comment.