[英]How to create a dictionary with the following DataFrame
考慮具有以下形狀的 dataframe:
label method args
Cluster 0 relayout ['shapes', 1]
Cluster 1 relayout ['shapes', 3]
Cluster 2 relayout ['shapes', 4]
我想創建一個看起來像這樣的字典:
{'buttons': [
{'label': 'Cluster 0', 'method': 'relayout', 'args': ['shapes', 1]},
{'label': 'Cluster 1', 'method': 'relayout', 'args': ['shapes', 3]},
{'label': 'Cluster 2', 'method': 'relayout', 'args': ['shapes', 4]},
]}
res = {'buttons': df.to_dict(orient='records')}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.