KeyError: 'offline_config' для запонок и сюжета - PullRequest
0 голосов
/ 19 марта 2020

Я хочу использовать запонки и сюжетно рисовать график; однако, как только я использую метод iplot, я получил ошибку A-ключа. Может ли кто-нибудь помочь мне решить эту проблему?

Пакеты, которые я импортировал

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pickle
#import chart_studio.plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf
init_notebook_mode(connected=True)
cf.go_offline
timeDataset = data_set
timeDataset['time'] = timeDataset['time'].dt.round('1s')
timeDataset['time_nanos'] = pd.to_timedelta(timeDataset['time_nanos'], unit='ns')
timeDataset['time'] = timeDataset['time'] + timeDataset['time_nanos']

##drop useless columns and reset index
timeDataset.drop(['time_nanos', 'venue', 'symbol', 'timeseries_id'], 1, inplace= True)
timeDataset = timeDataset.reset_index(drop=True)


timeDataset[timeDataset.market_state == 'Open'].set_index('time').resample('10T').size().iplot(kind = 'bar')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-273-a946448a59fd> in <module>
----> 1 timeDataset[timeDataset.market_state == 'Open'].set_index('time').resample('10T').size().iplot(kind = 'bar')

/opt/anaconda3/lib/python3.7/site-packages/cufflinks/plotlytools.py in _iplot(self, kind, data, layout, filename, sharing, title, xTitle, yTitle, zTitle, theme, colors, colorscale, fill, width, dash, mode, interpolation, symbol, size, barmode, sortbars, bargap, bargroupgap, bins, histnorm, histfunc, orientation, boxpoints, annotations, keys, bestfit, bestfit_colors, mean, mean_colors, categories, x, y, z, text, gridcolor, zerolinecolor, margin, labels, values, secondary_y, secondary_y_title, subplots, shape, error_x, error_y, error_type, locations, lon, lat, asFrame, asDates, asFigure, asImage, dimensions, asPlot, asUrl, online, **kwargs)
   1216         return iplot(figure,validate=validate,sharing=sharing,filename=filename,
   1217                          online=online,asImage=asImage,asUrl=asUrl,asPlot=asPlot,
-> 1218              dimensions=dimensions,display_image=kwargs.get('display_image',True))
   1219 
   1220 

/opt/anaconda3/lib/python3.7/site-packages/cufflinks/plotlytools.py in iplot(figure, validate, sharing, filename, online, asImage, asUrl, asPlot, dimensions, display_image, **kwargs)
   1414         show_link = auth.get_config_file()['offline_show_link']
   1415         link_text = auth.get_config_file()['offline_link_text']
-> 1416         config = auth.get_config_file()['offline_config']
   1417 
   1418         ## Remove validation if shapes are present

KeyError: 'offline_config'

...