Excel,  Python

[Python] NumPy 활용

FavoriteLoadingAdd to favorites

배열 데이터 계산 NumPy
===========================================================
Sample – 1 basic display *.reshape
===========================================================
import numpy as np

list1 = [0, 1, 2]
abc = np.array(list1)
print(abc)

==========================================================
데이터 구조화 Pandas
==========================================================
Sample – 1 Series 1차원 구조, 라벨을 활용한 연속된 Series 데이터생성
import pandas as pd
a1 = pd.Series([1,2,3,4])
print(a1)
print(a1.index)
print(a1.values)

import pandas as pd
b1 = pd.Series ({‘kor’:10,’eng’:20,’mat’:30})
print(b1)
==========================================================
Sample – 2 date_range() DatetimeIndex 형식의 날자 데이터

c1 = pd.date_range(start = None, end = None, periods = None, freq = ‘D’)
==========================================================
Sample – 3 DataFrame() – 행과열을 활용한 계산
==========================================================
import pandas as pd

data1 = [[1,1,1],[2,2,2],[3,3,3]]
df = pd.DataFrame(data1)
print(df)
==========================================================
Sample – 4 mixed

import numpy as np
import pandas as pd

data1 = np.array([[1,1,1],[2,2,2],[3,3,3]])
index1 = pd.date_range(‘2010-01-01’, periods=3)
col1 = [‘a’,’b’,’c’]

df = pd.DataFrame(data1, index=index1, columns=col1)
print(df)

error: Content is protected !!