반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Google Spreadsheet
- Github
- Excel
- Java
- numpy
- c#
- math
- Python
- PostgreSQL
- array
- 파이썬
- dataframe
- Mac
- matplotlib
- Google Excel
- list
- GIT
- Kotlin
- SQL
- PANDAS
- PySpark
- gas
- django
- hive
- google apps script
- Redshift
- Tkinter
- string
- Apache
Archives
- Today
- Total
목록to_dict (1)
달나라 노트
Python Pandas : to_dict (DataFrame을 dictionary로 변환하기, Series를 dictionary로 변환하기, DataFrame dictionary 변환, Series dictionary 변환)
pandas의 to_dict는 DataFrame에 적용하여 DataFrame을 dictionary로 변경해줍니다. import pandas as pd dict_1 = { 'col1': [1, 2, 3, 4, 5], 'col2': [6, 7, 8, 9, 10], 'col3': [11, 12, 13, 14, 15] } df_1 = pd.DataFrame(dict_1) print(df_1) dict_1 = df_1.to_dict() print(dict_1) -- Result col1 col2 col3 0 1 6 11 1 2 7 12 2 3 8 13 3 4 9 14 4 5 10 15 {'col1': {0: 1, 1: 2, 2: 3, 3: 4, 4: 5}, 'col2': {0: 6, 1: 7, 2: 8, 3: 9..
Python/Python Pandas
2021. 7. 15. 00:44