5

print(df.head)结果是

    ds                                  y
0   2019-03-01 10:57:32.381378+00:00    18760
1   2019-03-01 10:58:30.933070+00:00    28140
2   2019-03-01 10:58:45.425421+00:00    35520
3   2019-03-01 10:59:11.588687+00:00    50280
4   2019-03-01 10:59:19.064323+00:00    72420

在尝试使用 Facebook Prophet 时,我收到以下错误:ValueError: Column ds has timezone specified, which is not supported. Remove timezone.我现在尝试从我的 ds 列中删除时区。您知道如何实现这一目标吗?

df = pd.read_csv(
    'wob-2019-ticket-sales.csv',
    usecols=['created', 'total_gross'],
    parse_dates=['created'],
    # date_parser=lambda x: pd.to_datetime(x.rpartition('-')[0])
)

df['y'] = df['total_gross'].cumsum()
df = df.rename(columns={'created': 'ds'})
df = df.drop(columns='total_gross')

df.head()
4

0 回答 0