Skip to content

Pandas version-specific error: TypeError: ufunc 'isfinite' not supported for the input types #343

Description

@jaradc

With pandas version 0.20.3, the below code works. With pandas version 0.21.0, it throws the following error:

Traceback (most recent call last):
  File "C:/Users/jarad/Downloads/ffdsfee33.py", line 13, in <module>
    model.plot(fc)
  File "C:\Python35\lib\site-packages\fbprophet\forecaster.py", line 1260, in plot
    alpha=0.2)
  File "C:\Python35\lib\site-packages\matplotlib\__init__.py", line 1889, in inner
    return func(ax, *args, **kwargs)
  File "C:\Python35\lib\site-packages\matplotlib\axes\_axes.py", line 4770, in fill_between
    x = ma.masked_invalid(self.convert_xunits(x))
  File "C:\Python35\lib\site-packages\numpy\ma\core.py", line 2388, in masked_invalid
    condition = ~(np.isfinite(a))
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Re-creatable code example:

df = pd.read_clipboard(parse_dates=['ds'])

model = Prophet(yearly_seasonality=False, daily_seasonality=False)
model.fit(df)
future_df = model.make_future_dataframe(30)
fc = model.predict(future_df)
model.plot(fc)
plt.show()
ds y
5/15/2017 0.3664000
5/16/2017 0.3728000
5/17/2017 0.3596000
5/18/2017 0.3633399
5/19/2017 0.3576137
5/20/2017 0.3332930
5/21/2017 0.3808267
5/22/2017 0.3673000
5/23/2017 0.3587394
5/24/2017 0.3329000
5/25/2017 0.3492000
5/26/2017 0.3566112
5/27/2017 0.3615000
5/28/2017 0.3814000
5/29/2017 0.3465107
5/30/2017 0.3516000
5/31/2017 0.3298000
6/1/2017 0.3623000
6/2/2017 0.3609819
6/3/2017 0.3652000
6/4/2017 0.3728000
6/5/2017 0.3399985
6/6/2017 0.3586000
6/7/2017 0.3574000
6/8/2017 0.3727000
6/9/2017 0.3732567
6/10/2017 0.3725000
6/11/2017 0.3743000
6/12/2017 0.3495000
6/13/2017 0.3641000
6/14/2017 0.3585000
6/15/2017 0.3421000
6/16/2017 0.3513149
6/17/2017 0.3568000
6/18/2017 0.3457000
6/19/2017 0.3530000
6/20/2017 0.3397578
6/21/2017 0.3333000
6/22/2017 0.3527577
6/23/2017 0.3689000
6/24/2017 0.3743599
6/25/2017 0.3785000
6/26/2017 0.3629000
6/27/2017 0.3451601
6/28/2017 0.3674000
6/29/2017 0.3550000
6/30/2017 0.3590000
7/1/2017 0.3846000
7/2/2017 0.3628000
7/3/2017 0.3667000
7/4/2017 0.3711000
7/5/2017 0.3421000
7/6/2017 0.3645967
7/7/2017 0.3794752
7/8/2017 0.3929000
7/9/2017 0.3857000
7/10/2017 0.3760494
7/11/2017 0.3441000
7/12/2017 0.3666322
7/13/2017 0.3584000
7/14/2017 0.3691000
7/15/2017 0.3890000
7/16/2017 0.3824000
7/17/2017 0.3903000
7/18/2017 0.3726750
7/19/2017 0.3433075
7/20/2017 0.3424415
7/21/2017 0.3484333
7/22/2017 0.3838619
7/23/2017 0.3607334
7/24/2017 0.3624161
7/25/2017 0.3445446
7/26/2017 0.3652995
7/27/2017 0.3514286
7/28/2017 0.3648852
7/29/2017 0.3706496
7/30/2017 0.3572222
7/31/2017 0.3588297
8/1/2017 0.3374567
8/2/2017 0.3488459
8/3/2017 0.3591218
8/4/2017 0.3396043
8/5/2017 0.3636433
8/6/2017 0.3542834
8/7/2017 0.3449915
8/8/2017 0.3338922
8/9/2017 0.3516176
8/10/2017 0.3404888
8/11/2017 0.3492653
8/12/2017 0.3771050
8/13/2017 0.3621665
8/14/2017 0.3459562
8/15/2017 0.3319234
8/16/2017 0.3364871
8/17/2017 0.3464671
8/18/2017 0.3455390
8/19/2017 0.3291302
8/20/2017 0.3208030
8/21/2017 0.3321821
8/22/2017 0.3337696
8/23/2017 0.3289861
8/24/2017 0.3526127
8/25/2017 0.3611672
8/26/2017 0.3746895
8/27/2017 0.3720981
8/28/2017 0.3359440
8/29/2017 0.3726067
8/30/2017 0.3380052
8/31/2017 0.3473166
9/1/2017 0.3698962
9/2/2017 0.3783205
9/3/2017 0.3753667
9/4/2017 0.3897302
9/5/2017 0.3608144
9/6/2017 0.3454317
9/7/2017 0.3704847
9/8/2017 0.3772438
9/9/2017 0.3844822
9/10/2017 0.3872648
9/11/2017 0.3544398
9/12/2017 0.3474683
9/13/2017 0.3623862
9/14/2017 0.3415039
9/15/2017 0.3512003
9/16/2017 0.3580232
9/17/2017 0.3669942
9/18/2017 0.3522143
9/19/2017 0.3450433
9/20/2017 0.3420750
9/21/2017 0.3497456
9/22/2017 0.3705893
9/23/2017 0.3822981
9/24/2017 0.3886189
9/25/2017 0.3670670
9/26/2017 0.3592365
9/27/2017 0.3236036
9/28/2017 0.3651484
9/29/2017 0.3494884
9/30/2017 0.3788507
10/1/2017 0.3681230
10/2/2017 0.3402499
10/3/2017 0.3653453
10/4/2017 0.3616628
10/5/2017 0.3300067
10/6/2017 0.3489849
10/7/2017 0.3541858
10/8/2017 0.3404519
10/9/2017 0.3457787
10/10/2017 0.3483314
10/11/2017 0.3521676
10/12/2017 0.3784831
10/13/2017 0.3974615
10/14/2017 0.3769376
10/15/2017 0.3982707
10/16/2017 0.3665458
10/17/2017 0.4034299
10/18/2017 0.4028199
10/19/2017 0.3946326
10/20/2017 0.4132913
10/21/2017 0.4357214
10/22/2017 0.4370657
10/23/2017 0.4035825
10/24/2017 0.4017471
10/25/2017 0.3896750
10/26/2017 0.4086555
10/27/2017 0.3748427
10/28/2017 0.3646382
10/29/2017 0.4090890

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions