일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- math
- numpy
- dataframe
- Mac
- SQL
- google apps script
- array
- Google Excel
- Java
- Github
- c#
- PostgreSQL
- Tkinter
- Google Spreadsheet
- string
- PySpark
- 파이썬
- hive
- matplotlib
- PANDAS
- django
- Apache
- Redshift
- list
- Excel
- Python
- gas
- Kotlin
- GIT
- Today
- Total
목록Python/Python Pandas (77)
달나라 노트
Pandas의 columns는 DataFrame에 존재하는 Column의 정보를 출력해줍니다. import pandas as pddict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': [2, 3, 4, 5, 6],}df_test = pd.DataFrame(dict_test)print(df_test)print(df_test.columns)-- Result col1 col20 1 21 2 32 3 43 4 54 5 6Index(['col1', 'col2'], dtype='object') list() method를 이용해서 column을 list의 형태로 만들 수도 있습니다. import ..
pandas DataFrame에서 어떻게 Percentile Rank를 계산하는지 봅시다. (백분위, 백분위수에 대한 이해를 기반으로 합니다. 백분위 관련 개념 습득을 위해서는 아래 글을 참고하면 좋습니다.) https://cosmosproject.tistory.com/826 백분위(Percentile Rank), 백분위수(Percentile), 사분위수(Quartile) 알아보기 수학, 통계, 데이터 분석 등 다양한 곳에서 백분위라는 말이 쓰입니다. 수능 성적을 받아도 백분위라는 것이 있죠. 이 백분위라는 것이 무엇이고, 왜/어떻게 쓰이며, 어떻게 계산할 수 있는지 알 cosmosproject.tistory.com import pandas as pd dict_test = { 'col1': [ 10, 2..

openpyxl의 alignment를 이용하면 셀에 적힌 텍스트의 정렬을 할 수 있습니다. import pandas as pd from openpyxl.styles import Alignment dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['apple', 'banana', 'cloud', 'dream', 'electron'], 'col3': [1234, 0.27383720, 39372, None, 102947291.293472], 'col4': [0.9, 0.5238, 0.13, 0.0028, 1024.29278], } df_test = pd.DataFrame(dict_test) xlsx_writer = pd.ExcelWriter('test.xlsx', engin..

데이터를 다루다 보면 cell에 길이가 긴 텍스트가 들어갈 수도 있습니다. 이런 경우 column의 너비를 조절해야하는 상황이 생길 수 있는데, 문제는 일일이 컬럼마다 다 너비를 지정해주는건 한계가 있습니다. 그래서 openpyxl의 기능을 이용하여 column width autofit 기능을 구현해봅시다. import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['apple', 'banana', 'aspidfhadinfgkjadnfkskdjnv', 'drizzle', 'electron'], 'col3': [1234, 0.27383720, 39372, None, 102947291.293472], 'col4': [0.9, 0.5238, 0.1..