일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Redshift
- dataframe
- Google Excel
- google apps script
- string
- Mac
- Tkinter
- numpy
- Google Spreadsheet
- list
- Excel
- PANDAS
- matplotlib
- Apache
- Java
- PostgreSQL
- Github
- 파이썬
- math
- gas
- c#
- SQL
- hive
- GIT
- Kotlin
- Python
- django
- PySpark
- array
- Today
- Total
목록regexp_replace (2)
달나라 노트
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..
Redshift에선 Regular expression을 이용한 replace 기능을 제공합니다. regexp_replace(old_text, re_exp_pattern, new_text) regexp_replace의 사용법은 위와 같습니다. old_text에서 re_exp_pattern과 일치하는 부분을 찾아 new_text로 바꾸라는 뜻이죠. select regexp_replace('abc@123.com', '@.*\\.com', '') -> abc 반환 , regexp_replace('abc@email.com', '@.*\\.com', '') -> abc 반환 , regexp_replace('abc@email123.com', '@.*\\.com', '') -> abc 반환 ; 위 쿼리의 결과는 모두 ..