【发布时间】:2018-07-09 13:29:39
【问题描述】:
所以我发现了这个: Numpy: Fix array with rows of different lengths by filling the empty elements with zeros
但我真正想要的是:
mylist = [[1],[1,2],[1,2,3]]
mylist.fill()
>>> [[0,0,1], [0,1,2], [1,2,3]]
我知道 pandas 的 fillna 填充,但 0 在我的矩阵的右侧,我需要它们在左侧。有什么线索吗?
【问题讨论】:
-
你有没有试过写一个用零填充的函数?
-
来自帮助中心:仔细检查您问题的拼写。
标签: python arrays pandas numpy