Fundamentele Big Data cu PySpark
Upendra Devisetty
Science Analyst, CyVerse
Vizualizarea datelor reprezintă datele prin grafice sau diagrame
Instrumente open source pentru vizualizare în Python:
Reprezentarea grafică cu PySpark DataFrames se realizează prin trei metode
Biblioteca pyspark_dist_explore
toPandas()
Biblioteca HandySpark
Biblioteca Pyspark_dist_explore oferă informații rapide despre DataFrames
Disponibile în prezent trei funcții: hist(), distplot() și 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() nu este recomandatăPandas DataFrames sunt structuri în memorie, pe un singur server, iar operațiunile PySpark rulează în paralel
În Pandas, rezultatele sunt generate imediat, pe când în PySpark DataFrame operațiunile sunt evaluate leneș
Pandas DataFrames sunt mutabile, iar PySpark DataFrames sunt imuabile
API-ul Pandas suportă mai multe operațiuni decât API-ul PySpark DataFrame
test_df = spark.read.csv('test.csv', header=True, inferSchema=True)
hdf = test_df.toHandy()
hdf.cols["Age"].hist()
Fundamentele Big Data cu PySpark