通过特定的数据列,从循环中获取多个传说,作为传奇标题
我有一个图,可以通过列表中的不同数据库进行迭代。但是,我当然想知道哪个数据库是哪个图。数据库没有标题。因此,我正在考虑使用列 /行中的特定点。这对我来说很清楚我看到了什么数据库。
在我的数据库列表中包含的列 /行中提取特定的浮点,
我使用:precion_float = list_of_databases [list_index] [database_column_name] [database_index] < / code>
我想使用相同的原则对于我的地块循环。因此,我在想到这样的事情:
有关代码名称的某些上下文:
- dc_oppervlakte_filter是带有dataframes tp_target的列表
- ,是来自dataframes tp_smote的列名,
- 与tp_target
- strip_width是我想用于index index index tp_target strip_width的故事。 0
for k in dc_oppervlakte_filter:
plt.plot(k['TP_TARGET'], k['TP_SMOTE'], 'o', label = k['STRIP_WIDTH'][0])
plt.xlabel("TP_TARGET in ($\u00b0C$)")
plt.ylabel("TP_SMOTE in ($\u00b0C$)")
plt.legend(loc = 'lower right')
但是,这给了我错误:keyError:0
,所以我尝试了:
for k in dc_oppervlakte_filter:
plt.plot(k['TP_TARGET'], k['TP_SMOTE'], 'o', label = dc_oppervlakte_filter[k]['STRIP_WIDTH'][0])
plt.xlabel("TP_TARGET in ($\u00b0C$)")
plt.ylabel("TP_SMOTE in ($\u00b0C$)")
plt.legend(loc = 'lower right')
但是它给了我错误:typeError:列表索引必须是整数或切片,而不是dataframe,
对我来说,最佳场景看起来像是有特定的传说从用于绘制图形的每个数据库中选择的浮点。
I have a plot that iterates through different databases in a list. However, I of course want to know which database is what graph. The databases don't have a title. So I was thinking of using a specific point from a column / row. Which makes it clear for me what database I am seeing.
Inorder to extract a specific float from a column / row which is contained in my list of databases,
I use: specific_float = list_of_databases[list_index][database_column_name][database_index]
The same principle I would like to use for my for loop with plots. So I was thinking of something like this:
Some context about the names in the code:
- dc_oppervlakte_filter is the list with dataframes
- TP_TARGET is an column name from the dataframes
- TP_SMOTE same story as TP_TARGET
- STRIP_WIDTH is the column I want to use for my legend with index 0
for k in dc_oppervlakte_filter:
plt.plot(k['TP_TARGET'], k['TP_SMOTE'], 'o', label = k['STRIP_WIDTH'][0])
plt.xlabel("TP_TARGET in ($\u00b0C$)")
plt.ylabel("TP_SMOTE in ($\u00b0C$)")
plt.legend(loc = 'lower right')
However, this gives me the error: Keyerror: 0
So I tried:
for k in dc_oppervlakte_filter:
plt.plot(k['TP_TARGET'], k['TP_SMOTE'], 'o', label = dc_oppervlakte_filter[k]['STRIP_WIDTH'][0])
plt.xlabel("TP_TARGET in ($\u00b0C$)")
plt.ylabel("TP_SMOTE in ($\u00b0C$)")
plt.legend(loc = 'lower right')
But it gives me the error: TypeError: list indices must be integers or slices, not DataFrame
An optimal scenario for me would look like that there's an legend with the specific float chosen from every database that's used to plot a graph.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论