【问题标题】:How do you find the data type of the elements stored in the NumPy arrays? [duplicate]如何找到存储在 NumPy 数组中的元素的数据类型? [复制]
【发布时间】:2022-12-17 11:52:45
【问题描述】:
if a=b:
   print(a++b)
File "<string>", line 1
    if a=b:
        ^
SyntaxError: invalid syntax
if a!b:
   print(a/b) #Floor Division?
File "<string>", line 1
    if a!b:
        ^
SyntaxError: invalid syntax

尝试更改运营商,但也没有用。顺便说一句,我是 python 的新手。

【问题讨论】:

  • 您的问题正文与标题有何关系?
  • 请阐明您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python


【解决方案1】:
The astype() function creates a copy of the array, and allows you to specify 
the data type as a parameter. The data type can be specified using a string, 
like 'f' for float, 'i' for integer etc. or you can use the data type 
directly like float for float and int for integer.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    • 2015-10-16
    • 2012-07-03
    相关资源
    最近更新 更多