A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/50486 below:

DataFrameGroupBy.value_counts fails with a TimeGrouper · Issue #50486 · pandas-dev/pandas · GitHub

df = pd.DataFrame(
    {
        "Timestamp": [
            1565083561,
            1565083561 + 86400,
            1565083561 + 86500,
            1565083561 + 86400 * 2,
            1565083561 + 86400 * 3,
            1565083561 + 86500 * 3,
            1565083561 + 86400 * 4,
        ],
        "Food": ["apple", "apple", "banana", "banana", "orange", "orange", "pear"],
    }
).drop([3])

df["Datetime"] = to_datetime(df["Timestamp"].apply(lambda t: str(t)), unit="s")
gb = df.groupby(pd.Grouper(freq="1D", key="Datetime"))
print(gb.value_counts())

raises ValueError: operands could not be broadcast together with shapes (5,) (6,) (5,)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4