作者opengood5566 ( )
看板Python
标题[问题] 如何让numpy array改为包含两种数据类型?
时间Tue Sep 12 22:51:42 2017
有个numpy array
第一列是文字 第二列是数字
numpy就会把数全部的据类型设为字串
请问有办法
维持第一列的数据类型是字串的情况下
把第二列的数据类型改成数字吗?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.251.209.62
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1505227904.A.4A2.html
※ 编辑: opengood5566 (111.251.209.62), 09/12/2017 23:01:21
1F:推 Sunal: 型别不同不行 印象中numpy的array是用C实作的 09/12 23:16
2F:推 me1996017: 搜寻 numpy structured array 应该能找到 09/13 00:29
3F:推 steveyeh987: 用pandas dataframe可以做到 09/13 13:08
4F:推 fischcheng: Pandas是你的好朋友。Series/DataFrame都可 09/13 21:15
5F:推 numpy: pandas 的 apply 应该比我好用喔 09/29 01:34