[Python] Accessing Array Elements
Python Array Elements Accessing
2023-09-14 08:59:17 时间
NumPy Reference: Indexing
Note: Indexing starts at 0
(zero).
def slicing(): a = np.random.rand(5,4) print(a) """ [[ 0.15372787 0.83347785 0.86855635 0.23592008] [ 0.74925447 0.08453883 0.62021973 0.51972556] [ 0.33835541 0.03772665 0.53220179 0.2095391 ] [ 0.41991738 0.76028856 0.22081936 0.4240198 ] [ 0.93666236 0.72688287 0.99309427 0.69388106]] """ print(a[0:2, 0:4:3]) #0:4:3 X:Y:Z, if Y > Z, z is step, so here is take columns from [0,4), step is 3 """
[[ 0.15372787 0.23592008] [ 0.74925447 0.51972556]]
""" if __name__ == "__main__": slicing()
相关文章
- 二级Python选择题_二级python选择题题库
- Python_生成器和迭代器的区别
- aic准则python_Python数据科学:线性回归
- Python中break和continue的区别
- python的random()函数用法_Python随机函数random用法示例
- python中dtype的使用规范_Python numpy.dtype() 使用实例
- 简述python变量的命名规则_Python 变量命名规则
- 手机python 3.8解释器_Python 3.8 解释器安装教程
- python全局变量赋值_Python全局变量和局部变量[通俗易懂]
- 【说站】Python找回文子串的方法
- 【说站】python尾递归优化如何实现
- 简述Python特点_python优缺点
- python读取pkl_Python 读取文件
- python hexdump_笨办法学 Python · 续 练习 26:`hexdump`
- python自动化测试—Python自动化框架及工具
- 人生苦短,我用Python-手把手教你如何使用python写串口调试助手
- Python 实现Tracert追踪TTL值
- 搭建python开发环境-c++教程 如何搭建Python开发环境?
- 【测试开发】python系列教程:Python 推导式
- Python、MATLAB股票投资:ARIMA模型最优的选股、投资组合方案与预测
- Python基础语法-函数-函数装饰器-带参数的装饰器
- 自定义异常类 python
- python-Python与SQLite数据库-使用Python执行SQLite查询(二)
- Python reversed函数及用法
- 掌握Python访问MySQL的新技能(python访问mysql)
- Python序列(列表list和元组tuple)用法完全攻略
- Python实现Oracle数据库连接(python连接oracle数据库)
- 如何在Linux中安装Python?(linux安装python)
- Connecting to MSSQL with Python: A Comprehensive Guide for Beginners(python连接mssql)
- Python与Linux:开启互联网信息技术时代(python和linux)