![](/img/trans.png)
[英]How to make a dataframe from a list of tuples, where tuples are the values?
[英]How to make a smaller list of tuples from a large list of tuples?
我有大約50或60個元組的大清單。 形式:
a=[('a', 50), ('b', 46), ('c', 41), ('d', 35) ...]
我想要一個僅包含列表中前20個元組的新列表。 喜歡:
b=[('a', 50), ('b', 46), ('c', 41), ('d', 35) ... ,('aa', 10)]
可以使用列表切片來完成:
b = a[:20]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.