【发布时间】:2022-02-07 12:11:53
【问题描述】:
我从这个答案Python: Numpy Data IO, how to save data by different dtype for each column?的评论中了解到 那
那么'|'是什么意思表示在“|U5”中,为什么“|”在下面的示例中更改为“https://numpy.org/devdocs/user/basics.io.genfromtxt.html
data = u"1, abc , 2\n 3, xxx, 4"
# Without autostrip
np.genfromtxt(StringIO(data), delimiter=",", dtype="|U5")
array([['1', ' abc ', ' 2'],
['3', ' xxx', ' 4']], dtype='<U5')
【问题讨论】:
-
不重要。
-
@ddejohn 您建议的答案部分回答了我的第一个问题。我很感激你的建议。但我还是想知道为什么|这意味着“不适用”更改为
-
@ddejohn、@richardec、@mozway:我同意 OP:关于为什么
|变成<的问题不是重复的。 -
@Warren 确实有道理,但也许应该更新标题?
-
@mozway:同意——新标题听起来怎么样?