numpy and pandas

1.The difference between numpy and pandas Numpy is mostly used to create arrays and perform operations based on matrices. pandas is mostly used for processing tables and complex data processing 2. How to use pandas to import and export excel and csv files 2.1 Import import pandas as pd data_1=pd.read_csv(‘File name.csv’) data_2=pd.read_excel(‘File name.excel’) If there […]

Numpy arrays and matrices

Table of Contents 1. Create an array 1.1 Zero element array 1.2 1-element array 1.3 range function 1.4 Geometric Sequence 2. Data indexing and slicing 3. Array operations 3.1 Modify the array shape 3.2 Flip array 3.3 Connect arrays 3.4 Split array 3.5 Element addition and deletion 3.6 Array sorting 3.6.1 sort function 3.6.2 argsort […]

2D numpy skinning algorithm

Make a rest_post yourself. It is an equilateral triangle. The poses are a right triangle and an obtuse triangle. You can run it directly to observe the effect import matplotlib.pyplot as plt import numpy as np from scipy.optimize import lsq_linear from scipy.cluster.vq import vq, kmeans, whiten import time #PointCloudRegistrationAlgorithm import numpy as np def kabsch_2d(P, […]

Examples of some numpy functions

Self-used numpy functions Article directory numpy function 1. np.argsort 2.np.tile 3. np.repeat 4. np.repeat 5.np.astype 6.np.lexsort 7. np.random.permutation 8.np.arange Tips: The following is the text of this article, the following cases are for reference numpy function 1. np.argsort Requirement: Sort by the value of a certain row in the matrix and return the index value […]

numpy matrix picture frame

In an n×n array of n>5(n is an odd number), use * to draw an outer box and an inscribed rhombus. (This note is suitable for coders who are familiar with numpy) [The details of learning are a joyful process] Python official website: python cutting edge. Unfortunately it’s the original English version. So, I want […]

MyPractice_20230926_Numpy

My exercises_2023092_NumPy import numpy as np 1.2.2 Array transformation 1. Deformation caused by changes in the organization of elements Example 2 Construct a 2×4 matrix, the elements are consecutive integers starting from zero and ending with 7 ss=np.arange(8) ss array([0, 1, 2, 3, 4, 5, 6, 7]) ss.reshape(2,4) array([[0, 1, 2, 3], [4, 5, 6, […]

MyPractice_20231010_Numpy

MyPractice_20231010_Numpy import numpy as np a = np.arange(10) a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) a[2:4] = 100,101 a array([ 0, 1, 100, 101, 4, 5, 6, 7, 8, 9]) b=a[3:7] b[2]=-10 b array([101, 4, -10, 6]) a #Share the same data storage space array([ 0, 1, 100, 101, 4, -10, […]

MyPractice_20230921_Numpy

My exercises_20230921_NumPy 1.2.1 Array construction import numpy as np np.array([1,2,3,4]) array([1, 2, 3, 4]) np.array([1,2,3,4],[5,6,7,8]) ————————————————– —————————- TypeError Traceback (most recent call last) Cell In[3], line 1 —-> 1 np.array([1,2,3,4],[5,6,7,8]) TypeError: Field elements must be 2- or 3-tuples, got ‘5’ np.array([[1,2,3,4],[5,6,7,8]]) array([[1, 2, 3, 4], [5, 6, 7, 8]]) np.array([[[1,2,3,4],[5,6,7,8]],[[1,2,3,4],[5,6,7,8] ],[[1,2,3,4],[5,6,7,8]]]) array([[[1, 2, 3, 4], […]

Manipulate pixels using the Numpy module

Compiler: PyCharm 2023.2.1 (Professional Edition) Compilation environment: python3.11 Libraries: cv2, numpy 1. Create array with Numpy 1. Conventional array() method out = numpy.array(object,dtype,copy,order,subok,ndmin) parameter: object: required parameter, type array_like, can have four types: array, any object that exposes the array interface, an object whose __array__ method returns an array, or any (nested) sequence. The function […]