본문 바로가기
Python with AI

Numpy - Transposed Matrix(전치행렬), Reverse Matrix(역행렬), and Vector usage

by Oliver J 2022. 6. 28.
반응형

Here is an example to explain the matrix of Numpy Library

넘피 라이브러리의 매트릭스에 대해서 쉽게 눈으로보며 넘어갈 수 있게 만든 예제입니다. 

 

import numpy as np
import pandas as pd

a = np.matrix([[1,2], [3,4]]) # = ('1 2;3 4') << semi colon

print(a)

print(a.T) # np.matrix.T => a.T : create the transposed matrix of a

print(a.I) # np.matrix.I => a.I : create the reverse matrix of a

 

Results created by np.matrix can see them below with transposed matrix, and reverse matrix. 

np.matrix 로 생성한 매트릭스, 매트릭스 전치행렬, 그리고 매트릭스 역행렬  입니다.

 

Since the matrix is the basic data structure to utilize vast data, I remained this to understand for starters

다양한 데이터의 활용을 위한 기본적이면서도 필수적인 내용이므로 간략정리 하였습니다.

 

As for the starters, here may good understanding of the 2 dimension array usage.

초보자를 위한 것 으로써, 여기에서 2차원 배열의 인덱스와 컬럼 사용법을 잘 이해할 수 있습니다.

 

Usaged same matrix with above.

위와 같은 매트릭스의 사용 

first_row = a[0, :]
second_row = a[1,:]
first_col = a[:,0]
second_col = a[:,1]

 

 

Thanks!

깜삼돠~

728x90
반응형