일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- Google Excel
- numpy
- PANDAS
- google apps script
- string
- gas
- Excel
- SQL
- Mac
- 파이썬
- PySpark
- PostgreSQL
- matplotlib
- array
- Apache
- Tkinter
- math
- Redshift
- hive
- Kotlin
- dataframe
- GIT
- c#
- list
- Google Spreadsheet
- django
- Github
- Java
- Today
- Total
목록PANDAS (72)
달나라 노트
transform method는 DataFrame에서 groupby로 집계한 결과를 동일한 index를 가진 행에 넣어서 return해줍니다.말만 들으면 무슨 소린지 잘 감이 오지 않는데 실제 예시를 봅시다. import pandas as pddict_item = { 'date': [ 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200104 ], 'item_id': [ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4..
requests library와 API를 이용하다보면 csv format의 데이터를 얻어올 때가 있습니다. 그 결과값은 API를 어떻게 만드냐에 따라 달라질 수 있지만 주로 보이는 형태는 아래와 같습니다. import requests api_endpoint = 'https://test_api/get_data' response = requests.get(api_endpoint) print(response.status_code) print(response.content) print(type(response.content)) -- Result 200 b'modelno,name,price,weight\r\nAGH1341,Laptop,1300000,1200\r\nSOE1029,Desktop,1800000,3500..
pandas의 to_json() method는 DataFrame을 json 파일로 생성해주는 기능을 가집니다. Syntax DataFrame.to_json(file_name, orient) - file_name 생성할 json 파일의 이름을 적습니다. json 파일은 test_file.json 처럼 json이라는 확장자를 갖습니다. - orient 생성할 json 파일의 format을 의미합니다. columns, index, records, values, split의 다섯 종류가 있습니다. 각각의 orient 값이 어떤 형태를 의미하는지는 예시를 통해 알아봅시다. import pandas as pd dict_test = { 'name': ['apple', 'banana', 'peach'], 'price'..
pandas의 empty는 Series 또는 DataFrame이 비어있으면 True를 return합니다. 반대로 비어있지 않으면 False를 return합니다. import pandas as pd dict_test = { } df_test = pd.DataFrame(dict_test) print(df_test) print(df_test.empty) -- Result Empty DataFrame Columns: [] Index: [] True 위 예시는 비어있는 DataFrame인 df_test를 만들고 df_test의 empty를 적용한 결과입니다. DataFrame에 column도 row도 아무것도 없으니 비어있죠. 따라서 True가 return됩니다. import pandas as pd dict_te..