Skip to content

groupby.apply datetime bug affecting 0.17 #11324

Closed
@hadjmic

Description

@hadjmic

Exception is raised when
a) the original dataframe has a datetime column
b) the groupby.apply function returns a series object with a new datetime column

Code to reproduce:

import pandas as pd
import datetime

df = pd.DataFrame([['1', datetime.datetime.today()], 
                   ['2', datetime.datetime.today()],
                   ['2', datetime.datetime(2010, 1, 1)]],
                   columns=['record', 'date'])
dd = df.groupby('record').apply(lambda x: pd.Series({'max_date': x['date'].max()}))

This is a new issue affecting 0.17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions