Skip to content

Pandas 0.25 breaks tests #14859

Closed
Closed

Description

@jklymak

@jklymak Thanks! And yes, it's the pandas 0.25.0 that causes the failure, 0.24.2 was fine.

Can we change the test_bar_pandas(pd) to following to avoid this failure?

def test_bar_pandas(pd):
    # Smoke test for pandas
    pd.plotting.register_matplotlib_converters()
    fig, ax = plt.subplots()

    df = pd.DataFrame(
        {'year': [2018, 2018, 2018],
         'month': [1, 1, 1],
         'day': [1, 2, 3],
         'value': [1, 2, 3]})
    df['date'] = pd.to_datetime(df[['year', 'month', 'day']])

    monthly = df[['date', 'value']].groupby(['date']).sum()
    dates = monthly.index
    forecast = monthly['value']
    baseline = monthly['value']
    ax.bar(dates, forecast, width=10, align='center')
    ax.plot(dates, baseline, color='orange', lw=4)
    pd.plotting.deregister_matplotlib_converters()

i.e. register at beginning and deregister at the end.

Originally posted by @bingyao in #14739 (comment)

Activity

  1. jklymak commented on Jul 19, 2019

    @jklymak
    MemberAuthor

    @bingyao I think thats good as a stopgap measure. Can you do in a separate PR however so we can keep it straight? Don't close this issue though, because we should get to the root of the problem! Thanks for figuring this out!

  2. self-assigned this
    on Jul 19, 2019
  3. bingyao commented on Jul 19, 2019

    @bingyao
    Contributor

    @jklymak Okay, I will open a separate PR right away.

  4. dstansby commented on Jul 19, 2019

    @dstansby
    Member

    Quick update as I look into this; it seems that pd.plotting.deregister_matplotlib_converters() changed somehow in 0.25, and also de-registers our built in datetime converters, so I think this might be an upstream bug.

  5. timhoffm commented on Jul 16, 2020

    @timhoffm
    Member

    Fixed in newer pandas versions. pandas-dev/pandas#27481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions