From 8d804fce0cf6301c6ee6cdbdde3bcb6d377e7e19 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Mon, 18 Jun 2018 17:15:16 -0400 Subject: [PATCH] Explicitly use 64-bit integers in plot functions (#577) If this is installed on a 32-bit system (rare nowadays, but they still exist) then the conversion to `int` from `timedelta64[ns]` in `plot_cross_validation_metric` will fail. This patch explicitly uses an `np.int64` for this conversion. --- python/fbprophet/plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/fbprophet/plot.py b/python/fbprophet/plot.py index 6271964..1c4c21c 100644 --- a/python/fbprophet/plot.py +++ b/python/fbprophet/plot.py @@ -461,8 +461,8 @@ def plot_cross_validation_metric(df_cv, metric, rolling_window=0.1, ax=None): if np.timedelta64(1, dt) < np.timedelta64(tick_w, 'ns'): break - x_plt = df_none['horizon'].astype('timedelta64[ns]').astype(int) / float(dt_conversions[i]) - x_plt_h = df_h['horizon'].astype('timedelta64[ns]').astype(int) / float(dt_conversions[i]) + x_plt = df_none['horizon'].astype('timedelta64[ns]').astype(np.int64) / float(dt_conversions[i]) + x_plt_h = df_h['horizon'].astype('timedelta64[ns]').astype(np.int64) / float(dt_conversions[i]) ax.plot(x_plt, df_none[metric], '.', alpha=0.5, c='gray') ax.plot(x_plt_h, df_h[metric], '-', c='b')