小编rpa*_*nai的帖子

如何查看您的 GoogleColab 运行所在的区域?

在这条推文之后,我尝试在 Google Colab 上使用这个 GPU,但很不幸。我想知道这是否是由于我的笔记本运行所在的区域造成的,但我不知道如何检查。

  1. 我错过了设置 GPU 的东西吗?我关注了这篇文章[已解决!见更新2 ]
  2. 如何查看我来自 colab 的哪个地区?

更新

的输出!nvidia-smi


+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.56       Driver Version: 410.79       CUDA Version: 10.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 00000000:00:04.0 Off |                    0 |
| N/A   32C    P0    54W / 149W |    121MiB / 11441MiB |      0% …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-colaboratory

2
推荐指数
2
解决办法
1633
查看次数

使用plotly在一张图中绘制多条3d线

我有许多可变长度的二维序列,即列表列表,其中每个子列表都是一个序列。我想在 3d 可视化中投影这些序列/行/子列表,将时间步长作为另一个维度。到目前为止,我未能使用plotly.express.

import plotly.express as px

t = [[ii+1 for ii in range(len(features[i]))] for i in range(len(labels))]
x0 = [[x[0] for x in features[i]] for i in range(len(labels))]
x1 = [[x[1] for x in features[i]] for i in range(len(labels))]

df = pd.DataFrame(dict(
    X=[tii for ti in t for tii in ti],
    Y=[xii for xi in x0 for xii in xi],
    Z=[xii for xi in x1 for xii in xi],
    color=[aa for a in labels for aa in …
Run Code Online (Sandbox Code Playgroud)

python plot matplotlib pandas plotly

2
推荐指数
1
解决办法
1774
查看次数

绘制多线图,只有一条线着色

如何制作交互式多折线图,其中只有一条感兴趣的线是彩色的,而其他线都是灰色的:

所以在这里,我希望美国为红色,而其他国家为灰色。这是我到目前为止:

import pandas as pd
import plotly.express as px

df = px.data.gapminder()
fig = px.line(df, x='year', y='pop', color="country", hover_name="country",color_discrete_map={'United States': 'Red'})
fig.update_layout(autosize=False,width=700,height=500)
fig.show()
Run Code Online (Sandbox Code Playgroud)

但它只改变悬停颜色,不改变线条颜色

我尝试将 US 单独绘制为自己的图形,然后将其更新为原始图形,但效果不佳。

python plotly plotly-python

2
推荐指数
1
解决办法
509
查看次数

如何使用tsfresh python包从时间序列数据中提取特征?

我有一个列表列表,其中每个列表代表一个时间序列:

tsli=[[43,65,23,765,233,455,7,32,57,78,4,32],[34,32,565,87,23,86,32,56,32,57,78,32],[87,43,12,46,32,46,13,23,6,90,67,8],[1,2,3,3,4,5,6,7,8,9,0,9],[12,34,56,76,34,12,45,67,34,21,12,22]]
Run Code Online (Sandbox Code Playgroud)

我想使用代码使用 tsfresh 包从该数据集中提取特征:

import tsfresh
tf=tsfresh.extract_features(tsli)
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我收到值错误,即:

> ValueError: You have to set the column_id which contains the ids of the different time series
But i don't know how to deal with this and how to define column id for this problem.
Run Code Online (Sandbox Code Playgroud)

编辑1: 正如建议的那样,我尝试将数据集转换为数据,然后尝试:

import tsfresh
df=pd.DataFrame(tsli)
tf=tsfresh.extract_features(df)
Run Code Online (Sandbox Code Playgroud)

但值错误是相同的

> ValueError: You have to set the column_id which contains the ids of the different time series
Run Code Online (Sandbox Code Playgroud)

任何资源或参考都会有所帮助。

谢谢

python time-series feature-extraction tsfresh

2
推荐指数
1
解决办法
1万
查看次数

绘制多个饼图,其位置位于 for 循环中

我正在尝试用 Plotly 制作 2*7 的子图。

\n

我想使用 foor 循环迭代我的数据,为子图中的每个位置制作不同的饼图。\n我面临 2 个问题,我不知道如何在迭代时给出位置。\n而且我也不'即使我调用“show”方法,我的身材上也没有任何东西。

\n
import plotly.graph_objs as go\nfrom plotly.subplots import make_subplots\nlabels = stock_by_portals_private.index\n\nspec=[[{'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, \n{'type':'domain'}, {'type':'domain'}],\n  [{'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, \n{'type':'domain'}, {'type':'domain'}]]\n\nfig = make_subplots(rows=2, cols=7, specs=spec, print_grid=True)\ni = 1\nj = 1\nfor label in labels:\n    private = stock_by_portals_private[stock_by_portals_private.index == label]['id']\n    pro = stock_by_portals_pro[stock_by_portals_pro.index == label]['id']\n    fig.add_trace(go.Pie(labels=['PRO', 'PRIVATE'], values=[pro , private ],\\\n                     name="R\xc3\xa9partition des annonceurs par portail: " + str(label)), 1,1)\n\nfig.update_traces(hoverinfo='label+percent+name', textinfo='none')\nfig = go.Figure(fig)\nfig.show()\n
Run Code Online (Sandbox Code Playgroud)\n

python pandas plotly

2
推荐指数
1
解决办法
4457
查看次数

为什么我的箱线图在我用 plotly 着色时变窄了?

我正在尝试使用 plotly.express 作为箱线图绘制我存储在 Pandas DataFrame 中的数据。df 如下所示:

在此处输入图片说明


这是我在 plotly 中制作基本箱线图的代码:

import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups")
fig.show()
Run Code Online (Sandbox Code Playgroud)

结果给出了我正在寻找的那种图表: 在此处输入图片说明

现在,我想用不同的颜色为我使用的每个条件着色:

import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups",
             color="Condition")
fig.show()
Run Code Online (Sandbox Code Playgroud)

给我这个图表,现​​在箱形图比正常情况窄得多。有谁知道如何避免这种情况?谢谢 在此处输入图片说明

python plotly

1
推荐指数
1
解决办法
278
查看次数

简化条件运算符python

我是编程的新手.有没有办法简化条件运算符

a = 50; b = 70; c = 60; 

# Classification 

if (a == b and b == c and c ==a):
   print('Equilateral triangle')

elif (a == b or b == c or c == a):
   print('Isosceles triangle')

elif (a!=b and b!=c and c!=a):
   print('Scalene triangle')
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
68
查看次数

使用 PyQt6 播放声音

随着 PyQt6 模块的发布,我开始将我的代码从 PyQt5 移植到 PyQt6。

在 PyQt 中,有一个名为 phonon 的模块,用于播放声音。

在 PyQt5 中,有一个名为 QMediaPlayer 的模块,用于播放声音。

现在,如何在 PyQt6 中播放声音?

有网站说QMediaPlayer还没有移植,需要在PyQt6版本PyQt6.2中完成。

该网站是这样的 - https://www.pythonguis.com/faq/pyqt-pyside6-missing-modules/

该网站还表示,PyQt6.2 将于 2021 年 9 月发布。

导入是否已重命名?

python pyqt6

0
推荐指数
1
解决办法
4167
查看次数