python - 为什么我的 python 视觉效果在 Power BI 服务中显示比在 Power BI 桌面中慢?
问题描述
我在 Power BI 中制作了一个 python 视觉对象。代码如下所示。它在 Power BI 桌面上运行得非常快,视觉效果会在 1-2 秒内弹出。但是,当我将其发布到 Power BI 服务时,需要 10 秒才能显示此 python 视觉对象。为什么是这样?
dates_filtered = dataset.delivery_begin.unique()[-3:]
dataset_plot = dataset[dataset.delivery_begin.isin(dates_filtered)]
fig, ax = matplotlib.pyplot.subplots()
if len(dates_filtered) == 3:
colors = {
dates_filtered[0] : "#92bbea" ,
dates_filtered[1] : "#ea9d9a",
dates_filtered[2] : "#85ceb3"}
elif len(dates_filtered) == 2:
colors = {
dates_filtered[0] : "#ea9d9a",
dates_filtered[1] : "#85ceb3"}
else:
colors = {dates_filtered[0] : "#85ceb3"}
grouped = dataset_plot.groupby('delivery_begin')
for key, group in grouped:
group.plot(ax=ax, kind='line', x = "ep_based_cumsum_bins", y = "adjusted_energy_price", label=key, c= colors[key], legend=False, linewidth = 4)
# grouped.apply(lambda x: x.plot(ax=ax, kind='line', x = "ep_based_cumsum_bins", y = "adjusted_energy_price", label=x.name, c= colors[x.name], legend=False, linewidth = 4))
for item in [fig, ax]:
item.patch.set_visible(False)
ax.axis('off')
# ax.legend(dataset_plot.delivery_begin.unique(), loc = 'upper left')
legend = matplotlib.pyplot.legend(fontsize=22, loc = 'upper left', frameon = False)
matplotlib.pyplot.setp(legend.get_texts(), color = 'none')
# ax.legend(loc='upper left', fancybox=True, framealpha=0)
matplotlib.pyplot.show()
解决方案
推荐阅读
- swift - 如何添加bannerAds添加到弹出视图swift 4
- microsoft-teams - 在 MSTeams 桌面客户端中使用 SPFx webpart 加载 SP 页面时,AadHttpClient 失败
- spring-cloud-stream - QueryableStoreRegistry 用于查询spring cloud stream中的状态存储,不知道能不能查询远程的?
- java - 如何在不退出函数的情况下从函数返回值?
- python - 从带有图像和数据的网站中抓取数据
- laravel - 从 API laravel 获取 2 个数据
- javascript - 验证不适用于 React 组件中的自动完成功能
- flutter - Flutter 在 Stack 上使用 constrainedBox 设置 maxWidth
- python - 在python语言中将类似json的结构转换为json
- pandas - 熊猫数据框中分组的优先级