word count1 pyspark word count 분석 PySpark를 사용한 워드 카운트(Word Count) 알고리즘의 구현과 동작 원리를 분석한다. 전체 코드import pysparktest_file = "hello.txt"sc = pyspark.SparkContext.getOrCreate()text_file = sc.textFile(test_file)counts = text_file.flatMap(lambda line: line.split(" ")) \ .map(lambda word: (word, 1)) \ .reduceByKey(lambda a, b: a + b)print(counts.collect())hello.txt 파일hello worldhello worldhello 1. SparkContext 생성 .. 2025. 2. 26. 이전 1 다음 반응형