Read txt as json
Read txt as json
Read txt as json
- Spark에서 데이터 값은 json이지만, 파일 형식이 txt인 경우가 존재
- 이 값을 읽는 방법을 몰라서 많이 찾아봤는데, 다음과 같이 그냥 json 읽듯이 txt 파일을 읽으면 됨
df = spark.read.json("/some/path/txt/*.txt")
- df에 정상적으로 읽힌 데이터프레임이 저장됨
df = spark.read.json("/some/path/txt/*.txt")