欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python Numpy Tutorials: 数据类型

程序员文章站 2023-11-22 23:53:46
# -*- coding: utf-8 -*- """ python version: 3.5 created on thu may 11...
# -*- coding: utf-8 -*-
"""
python version: 3.5
created on thu may 11 16:32:36 2017
e-mail: eric2014_lv@sjtu.edu.cn
@author: didilv
"""

import numpy as np

x = np.array([1,2])
print(x.dtype) #在python 3.5里面,整数减小了内存int32

y = np.array([[1.,3.], [3.,5.]])
print(y.dtype)
print(type(y)) #注意区分: y是一个类只是是numpy的array,
                # dtype是指元素的类型:(data type:数据类型)

z = np.array([1,2], dtype = np.int64) # 可以给制定内存
print(z.dtype)