<jupyter_start><jupyter_text>* Series는 index를 공유함에 있어 list와 다르다.<jupyter_code># 버전 확인
print("pandas 버전 ", pd.__version__)
## 실습
## 홍길동 팀 대항 게임 5일간 점수
# score = Series([1000, 14000, 3000, 3000, 1000])

## 날짜를 인덱스로 시리즈 만들기
gildong = Series([1000, 14000, 3000, 3000, 1000],
              index = [20191005, 20191006, 20191007, 20191008, 20191009])
gildong
## 토토팀 5일간 점수 만들기

toto = Series([2000, 12000, 5600, 3000, 1200],
              index = [20191005, 20191006, 20191007, 20191008, 20191009])
toto
pd.DataFrame({'date' : [20191005, 20191006, 20191007, 20191008, 20191009],
              'gildong' : [1000, 14000, 3000, 3000, 1000],
              'toto' : [2000, 12000, 5600, 3000, 1200]})
A = {'gildong' : [1000, 14000, 3000, 3000, 1000],
              'toto' : [2000, 12000, 5600, 3000, 1200],
              'apple' : [4000, 5000, 6000, 5500, 4500],
              'catanddog' : [7000, 5000, 3000, 5000, 4000]}
A = DataFrame(A)
A
A = A.set_index('date')
a =A.sum(axis=1)
B = pd.DataFrame({'gildong' : [1000, 14000, 3000, 3000, 1000],
              'toto' : [2000, 12000, 5600, 3000, 1200],
              'apple' : [4000, 5000, 6000, 5500, 4500],
              'catanddog' : [7000, 5000, 3000, 5000, 4000],
              'total' : a})
B
## total 제작

A['total'] = A.sum(axis=1)
A
## 행열 접근

# A[행, 열]
A[0:3] # 0,1,2, 행 선택

A.iloc[0:2, :] # 행 번호로 접근
## apple과 catanddog 선택

A.loc[:, ['apple', 'catanddog']]
A.loc['20191006':'20191007',:] # 이름으로 접근
# total 제거

A.drop(['total'], axis=1)
A.drop([2,3], axis=0)
date = ['19-05-01','19-05-02', '19-05-03', '19-05-04', '19-05-05']
df = DataFrame(df,
               index=date)
A.sort_values('total',ascending=False)
date = ['19-05-01','19-05-02', '19-05-03', '19-05-04', '19-05-05']
df = DataFrame(A,
               index=date)
df<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19722222222222222, 'fraction_numerical': 0.26666666666666666, 'mean_word_length': 2.984513274336283, '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': '153837', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 1186, 'n_tokens_neox': 861, 'n_words': 187, 'path': 'A/code/ex_pandas.ipynb', 'repo_name': 'rkyungah/Basic.github.io', 'size': '1800'}