Python
[금융공학 / 파이썬] day1
dbfl9911
2024. 7. 12. 15:17
반응형
Google Colab Notebook
Run, share, and edit Python notebooks
colab.research.google.com
- numpy
import numpy as np
arr1 = np.array([4,3,2,1])
arr1 * 3
array([12, 9, 6, 3])
from numpy import array
array([4,3,2,1])
array([4, 3, 2, 1])
list4 = [7,5,4]
list5 = [9,6,1]
list6 = [list4, list5]
list6[0][1]
arr2 = np.array(list6)
arr2.shape #행, 열 개수 알려줌
(2, 3)
- pandas
import pandas as pd
#arr2를 pandas의 DataFram함수에 넣어보세요
df1 = pd.DataFrame(arr2)
df1.values
array([[7, 5, 4],
[9, 6, 1]])
df1.columns = ["a", "b", "c"]
df1.index = ["2024-07-12", "2024-07-13"]
df1.info()
df1.describe()
df1.plot()
df1.shape
(2, 3)
반응형