<U12是什么类型?

bak*_*kka 1 python arrays types numpy pandas

我一直使用pandasnumpy处理一些数据,直到得到两个类似的数组输出:

array(['french', 'mexican', 'cajun_creole', ..., 'southern_us', 'italian',
       'thai'], dtype='<U12')

array(['french', 'mexican', 'cajun_creole', ..., 'jamaican', 'italian',
   'thai'], dtype=object)
Run Code Online (Sandbox Code Playgroud)

我看不出有什么区别<U12

Ste*_*uch 6

<U12 那是一个numpy类型:

< 小端

U 统一码

12 12个字符:

来源

  • 最高实用度与简洁度奖。 (3认同)
  • @piRSquared,一直在练习我的简洁。字符是昂贵的。 (2认同)