일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- array
- gas
- PySpark
- matplotlib
- PANDAS
- SQL
- GIT
- math
- Google Spreadsheet
- Redshift
- list
- Apache
- numpy
- c#
- PostgreSQL
- Kotlin
- string
- Tkinter
- django
- 파이썬
- Github
- Java
- google apps script
- Mac
- Google Excel
- Excel
- dataframe
- hive
- Python
- Today
- Total
목록Python (384)
달나라 노트
regexp_replace(, , ) pyspark의 regexp_replace는 위처럼 사용할 수 있습니다. 에 있는 데이터들에 대해 과 일치하는 부분을 로 바꿔서 반환합니다. from pyspark.sql import SparkSession from pyspark.sql.functions import col, regexp_replace import pandas as pd spark = SparkSession.builder.getOrCreate() df_test = pd.DataFrame({ 'a': [1, 2, 3], 'b': [10.0, 3.5, 7.315], 'c': ['apple', 'banana', 'tomato'] }) df_spark = spark.createDataFrame(df_test..

python 파일을 실행하는 방법은 사용하는 code editor 내에서 실행하는 방법도 있지만 terminal(또는 명령 프롬프트 등)에서 직접 해당 파일을 실행할 수도 있습니다. test.py print('Hello world!') test.py 파일에 위와 같은 print 코드를 적어두고 위처럼 terminal에서 test.py 파일이 있는 위치로 이동한 후 python 형태로 명령어를 적어주면 test.py가 실행되는 것을 알 수 있죠. 이처럼 terminal에서 python 파일을 실행시킬 때에는 단순히 파일 실행 뿐 아니라 위 이미지처럼 파일 실행 시 옆에 apple, banana, sky 등 여러 기타 인자들을 전달할 수 있습니다. 위처럼 전달된 인자들을 받기 위해서는 sys.argv를 사용..
spark dataframe은 table에 삽입될 수도 있지만 AWS s3 server에 upload될 수도 있습니다. from pyspark.sql import SparkSession spark = SparkSession.builder\ # 1 .appName('Test_runner')\ .config('hive.mapred.mode', 'nonstrict')\ .config('hive.exec.dynamic.partition', 'true')\ .config('hive.exec.dynamic.partition.mode', 'nonstrict')\ .config('hive.exec.parallel', 'true')\ .config('hive.stats.fetch.column.stats', 'true')..
spark dataframe은 dataframe의 어떤 table안에 삽입될 수 있습니다. from pyspark.sql import SparkSession spark = SparkSession.builder\ # 1 .appName('Test_runner')\ .config('hive.mapred.mode', 'nonstrict')\ .config('hive.exec.dynamic.partition', 'true')\ .config('hive.exec.dynamic.partition.mode', 'nonstrict')\ .config('hive.exec.parallel', 'true')\ .config('hive.stats.fetch.column.stats', 'true')\ .config('hive...