ndim在numpy中的工作 [英] working of ndim in numpy

查看:62
本文介绍了ndim在numpy中的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import numpy as np
>>> a=np.array([1,2,3,4])
>>> a
array([1, 2, 3, 4])
>>> a.ndim
1

维度是1的方式.我给出了一个包含3个变量的方程式,这意味着它是3维,但是将维度显示为1.谁能告诉我ndim的逻辑?

How the dimension is 1 .I have given a equation of 3 variables it means it is a 3 dimension but it is showing the dimension as 1 . Can anyone tell me the logic of ndim?

推荐答案

您已经创建了一个包含四个元素的数组.也就是说,一个向量.正如NumPy所说,它具有一个维度.

You have created an array with four elements. That is, a vector. It has one dimension, as NumPy says.

这篇关于ndim在numpy中的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆