PySpark के साथ Big Data Fundamentals
Upendra Devisetty
Science Analyst, CyVerse
Data visualization का मतलब है अपने डेटा को ग्राफ़ या चार्ट में दिखाना
Python में visualization के लिए open source plotting tools:
PySpark DataFrames से plotting तीन तरीकों से की जाती है
pyspark_dist_explore लाइब्रेरी
toPandas()
HandySpark लाइब्रेरी
Pyspark_dist_explore लाइब्रेरी DataFrames पर तेज़ insights देती है
अभी तीन फंक्शन उपलब्ध हैं: hist(), distplot(), और pandas_histogram()
test_df = spark.read.csv("test.csv", header=True, inferSchema=True)
test_df_age = test_df.select('Age')
hist(test_df_age, bins=20, color="red")
test_df = spark.read.csv("test.csv", header=True, inferSchema=True)
test_df_sample_pandas = test_df.toPandas()
test_df_sample_pandas.hist('Age')
toPandas() इस्तेमाल करना बेहतर नहीं हैPandas DataFrames इन-मेमोरी, single-server संरचनाएँ हैं, जबकि PySpark पर ऑपरेशन parallel चलते हैं
Pandas में ऑपरेशन लगाते ही परिणाम मिलता है, पर PySpark DataFrame में lazy evaluation होती है
Pandas DataFrame mutable है और PySpark DataFrames immutable हैं
Pandas API, PySpark DataFrame API से ज़्यादा ऑपरेशंस सपोर्ट करती है
test_df = spark.read.csv('test.csv', header=True, inferSchema=True)
hdf = test_df.toHandy()
hdf.cols["Age"].hist()
PySpark के साथ Big Data Fundamentals