일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Kotlin
- c#
- PySpark
- gas
- SQL
- Github
- Python
- array
- Excel
- django
- Mac
- dataframe
- 파이썬
- PANDAS
- list
- hive
- PostgreSQL
- Google Excel
- GIT
- string
- Java
- math
- Apache
- matplotlib
- Google Spreadsheet
- google apps script
- Redshift
- Tkinter
- numpy
- Today
- Total
목록Python/Python Basic (81)
달나라 노트
어떤 폴더나 파일의 경로를 나타낼 때 보통 우리는 아래와 같은 표현 방식을 사용합니다. my_program/tester/Code/test_program.py 근데 위 표현식은 OS에 따라 에러를 일으킬 수 있습니다. Mac/Linux에서는 폴더, 파일 구분자로서 슬래쉬(Slash, /)를 사용하지만, Windows에서는 폴더, 파일 구분자로서 역슬래쉬(Backward slash, \)를 사용하기 때문입니다. Mac/Linux = my_program/tester/Code/test_program.py Windows = my_program\tester\Code\test_program.py 혼자서 프로그래밍을 한다면 또는 그렇게 규모가 크지 않은 협업을 한다면 위 차이가 전혀 상관없을 수 있습니다. 저 또한 M..
dictionary를 JSON data로 바꾸고 .json 파일을 생성해봅시다. - 참고 = dictionary json 변환 https://cosmosproject.tistory.com/758 import json dict_data = { "category": "fruits", "product_cnt": 2, "product": { "Apple": { "price": 20000, "weight": 3 }, "Watermelon": { "price": 18000, "screen_size": 2 }, } } json_data = json.dumps(dict_data) print(json_data) print(type(json_data)) with open('json_data.json', 'w') as f:..
JSON (JavaScript Object Notation) 데이터는 프로그래밍에서 자주 쓰이는 형태의 데이터입니다. 다양한 정보를 보고 다루기 쉽게 저장할 수 있죠. 기본적으로 JSON data는 Python의 dictionary type과 매우 유사합니다. Python의 dictionary를 JSON 형태의 string으로 변환하기 위해서는 json library의 dumps method를 사용하면 됩니다. Syntax json.dumps(dictionary, indent=n) - dictionary JSON 형태의 string으로 변환할 dictionary 입니다. - indent = n optional한 parameter입니다. 명시하지 않아도 되며 명시할 경우 출력할 때 더 보기 쉽게 n개 만큼..
islower() method는 string에 적용할 수 있으며, 문자열에 포함된 모든 알파벳이 모두 소문자일 경우 True를 return합니다. 문자열에 포함된 알파벳 중 하나라도 대문자일 경우 False를 return합니다. isupper() method는 string에 적용할 수 있으며, 문자열에 포함된 모든 알파벳이 모두 대문자일 경우 True를 return합니다. 문자열에 포함된 알파벳 중 하나라도 소문자일 경우 False를 return합니다. Syntax string.islower() string.isupper() 사용법은 간단합니다. 두 method 모두 그냥 string에 적용하면 됩니다. str_test = 'abcde' print(str_test.islower()) -- Result T..