반응형
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 |
29 | 30 |
Tags
- matplotlib
- Python
- string
- Mac
- Kotlin
- hive
- 파이썬
- math
- Java
- Redshift
- Excel
- numpy
- PostgreSQL
- PANDAS
- array
- gas
- Apache
- django
- c#
- SQL
- Github
- Tkinter
- dataframe
- PySpark
- Google Excel
- Google Spreadsheet
- list
- google apps script
- GIT
Archives
- Today
- Total
목록행열 뒤집기 (1)
달나라 노트
Python Pandas : transpose (DataFrame 행/열 뒤집기)
pandas의 transpose는 DataFrame의 행/열을 서로 변경한 새로운 DataFrame을 생성해줍니다. import pandas as pd dict_1 = { 'col1': [1, 2, 3, 4, 5], 'col2': [6, 7, 8, 9, 10], 'col3': [11, 12, 13, 14, 15], 'col4': [16, 17, 18, 19, 20] } df_1 = pd.DataFrame(dict_1) print(df_1) df_2 = df_1.transpose() print(df_2) -- Result col1 col2 col3 col4 0 1 6 11 16 1 2 7 12 17 2 3 8 13 18 3 4 9 14 19 4 5 10 15 20 0 1 2 3 4 col1 1 2 3 4 ..
Python/Python Pandas
2021. 7. 15. 00:34