Example of adding a row or column to a python matrix_python

不言
Release: 2018-04-04 16:35:03
Original
7958 people have browsed it

Below I will share with you an example of adding a row or column to a Python matrix. It has a good reference value and I hope it will be helpful to everyone. Let’s take a look together

Add rows to the matrix

np.row_stack() 与 np.column_stack()
import numpy as np
a = np.array([[4, 4,], [5, 5]])
c = np.row_stack((a, [8,9]))
d = np.column_stack((a, [8,9]))
Copy after login

Related recommendations:

Distance measurement and python implementation

Python implementation of two-dimensional array output as picture_python

The above is the detailed content of Example of adding a row or column to a python matrix_python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!