| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- PySpark
- 파이썬
- numpy
- Kotlin
- Google Excel
- django
- Tkinter
- SQL
- string
- GIT
- math
- PostgreSQL
- hive
- Redshift
- Apache
- c#
- PANDAS
- google apps script
- dataframe
- Java
- list
- array
- gas
- Presto
- Google Spreadsheet
- Github
- Excel
- Python
- matplotlib
- Today
- Total
목록Python (388)
달나라 노트
Python Pandas에는 DataFrame을 복사하여 clipboard로 넣어주는 to_clipboard라는 기능을 제공합니다. import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': [6, 7, 8, 9, 10], 'col3': [11, 12, 13, 14, 15] } df_test = pd.DataFrame(dict_test) df_test.to_clipboard(sep='\t', index=False) 위처럼 Test용 DataFrame을 만든 후 to_clipboard를 적용시킵니다. sep='\t'는 DataFrame의 column separator를 tab(\t)으로 하겠다는 뜻이고, index=False는 DataFrame의..
Pandas에서는 어떤 list에 존재하는 요소가 대상 DataFrame이나 Series에 존재 하는지를 True(존재), False(존재안함)로 반환해주는 isin method를 제공합니다. import pandas as pd list_test = [1, 2, 3, 4, 5] seri_test = pd.Series(list_test) print(seri_test) print(type(seri_test)) - Output 0 1 1 2 2 3 3 4 4 5 dtype: int64 먼저 test용 Series를 만듭시다. seri_test_1 = seri_test.isin([1, 3, 5]) print(seri_test_1) print(type(seri_test_1)) - Output 0 True 1 Fa..
Pandas에선 DataFrame에 존재하는 Data를 정렬하기 위한 sort_values라는 함수를 제공합니다. import pandas as pd dict_test = { 'col1': [3, 1, 2, 3, 2, 1], 'col2': ['b', 'a', 'd', 'e', 'y', 'z'] } df_test = pd.DataFrame(dict_test) print(df_test) print(type(df_test)) - Output col1 col2 0 3 b 1 1 a 2 2 d 3 3 e 4 2 y 5 1 z 먼저 테스트용 DataFrame을 만듭시다. df_test_sorted = df_test.sort_values(by=['col1'], ascending=True) print(df_test_s..
Pandas에서는 DataFrame에 있는 Column들의 Data type을 바꾸기 위해 astype이라는 method를 제공합니다. import pandas as pddict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': [1.0, 2.0, 3.0, 4.0, 5.0], 'col3': ['1.2', '2.3', '3.4', '4.5', '5.6'],}df_test = pd.DataFrame(dict_test)print(df_test)print(type(df_test))print('col1 dtype :', df_test['col1'].dtype)print('col2 dtype :', df_test['col2'].dtype)print('col3 dtype :'..