일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- PostgreSQL
- GIT
- dataframe
- Excel
- Mac
- math
- Java
- 파이썬
- hive
- Github
- array
- Google Excel
- Kotlin
- gas
- numpy
- SQL
- c#
- Redshift
- string
- PySpark
- django
- Apache
- google apps script
- Tkinter
- Python
- Google Spreadsheet
- list
- PANDAS
- matplotlib
- Today
- Total
목록Python (384)
달나라 노트
Python에서 여러 라이브러리를 사용하다보면 최신 버전의 라이브러리로 업그레이드를 해야 할 경우가 있습니다. 그런 경우 아래와 같은 명령어를 terminal에서 사용할 수 있습니다. pip install --upgrade library_name 예를들어 pandas library를 upgrade한다고하면 terminal에 아래의 명령어를 입력하면 됩니다. pip install --upgrade pandas
Python에서 여러 라이브러리를 사용하다보면 어떤 library가 설치되어있고 각 library의 버전은 몇인지 알아볼 필요가 생길 때가 있습니다. 그럴때 사용할 수 있는 명령어는 아래 2가지가 있습니다. pip list -- Result Package Version ----------------- ------------------- Django 3.1.1 openpyxl 3.0.6 pandas 1.3.3 pip 20.2.2 psycopg2 2.8.5 requests 2.25.1 slack-sdk 3.10.1 slackclient 1.3.1 pip freeze -- Result Django @ file:///tmp/build/80754af9/django_1600355803933/work numpy @ ..
Python Pandas에는 DataFrame이나 Series를 json 형태로 변환해주는 to_json이라는 method가 있습니다. 예시를 보시죠. import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['a', 'b', 'c', 'd', 'e'], 'col3': ['Apple', 'Banana', 'Watermelon', 'Grape', 'Melon'] } df_test = pd.DataFrame(dict_test) print(df_test) json_test = df_test.to_json() print(json_test) -- Result col1 col2 col3 0 1 a Apple 1 2 b Banana 2 3 c Water..