<jupyter_start><jupyter_text><jupyter_code>pip install pandas
import pandas as pd
sr = pd.Series([17000, 18000, 1000, 5000], index=["피자", "치킨", "콜라", "맥주"])
print(sr)
print(sr.values)
print(sr.index)
values = [[1,2,3], [4,5,6], [7,8,9]]
index = ['i1', 'i2', 'i3']
columns = ['A', 'B', 'C']
df = pd.DataFrame(values, index=index, columns=columns)
print(df)
print(df.index)
print(df.columns)
print(df.values)
# 리스트로 생성하기
data = [
    ['1000', 'Steve', 90.72], 
    ['1001', 'James', 78.09], 
    ['1002', 'Doyeon', 98.43], 
    ['1003', 'Jane', 64.19], 
    ['1004', 'Pilwoong', 81.30],
    ['1005', 'Tony', 99.14],
]
df = pd.DataFrame(data)
print(df)
df = pd.DataFrame(data, columns=['학번', '이름', '점수'])
print(df)
# 딕셔너리로 생성하기
data = { '학번' : ['1000', '1001', '1002', '1003', '1004', '1005'],
'이름' : [ 'Steve', 'James', 'Doyeon', 'Jane', 'Pilwoong', 'Tony'],
         '점수': [90.72, 78.09, 98.43, 64.19, 81.30, 99.14]}

df = pd.DataFrame(data)
print(df)
df.head(3)
df.tail(3)
df['학번']
from google.colab import drive
drive.mount('/gdrive', force_remount=True)
fileDf = pd.read_csv('/gdrive/MyDrive/dataset/pima-indians-diabetes.csv')
print(fileDf)
print(fileDf.index)
pip install numpy
import numpy as np
a = np.array([1,2,3,4,5])
type(a)
b = np.array([[1,2,3],[4,5,6]])
b
print(b.ndim) # n 차원
print(b.shape) # 크기
print(a.ndim)
print(a.shape)
a = np.zeros((2, 3))
print(a)
a = np.zeros(3)
print(a)
a = np.ones((2,3))
print(a)
a = np.full((2,2), 8)
print(a)
a = np.eye(3)
print(a)
a = np.random.random((2,2))
print(a)
a = np.arange(10)
print(a)
 a = np.arange(1, 10, 2)
 print(a)
a = np.array(np.arange(30)).reshape((5,6))
print(a)
import numpy as np
a = np.array([[1,2,3], [4,5,6]])
b = a[0:2, 0:2]
print(b)
b = a[0, :]
print(b)
b = a[:, 1]
print(b)
a = np.array([[1,2],[4,5],[7,8]])
b = a[[2,1],[1,0]]
print(b)
x = np.array([1,2,3])
y = np.array([4,5,6])
b = x + y
print(b)
b = x - y
print(b)
b = b * x
print(b)
b = b / x
print(b)
a = np.array([[1,2],[3,4]])
print(a)
b = np.array([[5,6],[7,8]])
print(b)
c = np.dot(a, b) # 벡터와 행렬의 곱 또는 행렬 곱을 위해서 dot()을 사용한다.
print(c) 
%matplotlib inline
import matplotlib.pyplot as plt

plt.title('test')
plt.plot([1,2,3,4],[2,4,8,6])
plt.show()
plt.title('test2')
plt.plot([1,2,3,4],[2,4,8,6])
plt.xlabel('hours')
plt.ylabel('score')
plt.show()
plt.title('students')
plt.plot([1,2,3,4],[2,4,8,6])
plt.plot([1.5,2.5,3.5,4.5],[3,5,8,10])
plt.xlabel('hours')
plt.ylabel('score')
plt.legend(['A student', 'B student'])
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.27009646302250806, 'fraction_numerical': 0.09405144694533762, 'mean_word_length': 4.856470588235294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '252758', 'license': 'MIT', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1316, 'n_words': 246, 'path': 'colab/intro_datastructure.ipynb', 'repo_name': 'cateto/python4NLP', 'size': '2488'}