PySpark Distribution Explorer (pyspark-dist-explore, current version 0.1.8) is a Python library that enables creating histogram and density plots directly from PySpark DataFrames. It simplifies exploratory data analysis (EDA) for large datasets by leveraging Matplotlib and Pandas to visualize distributions. The project is currently in maintenance mode with infrequent updates.
pip install pyspark-dist-exploreVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a SparkSession, create a sample DataFrame, and then use `hist`, `density_plot`, and `describe_pd` to visualize and summarize numerical distributions. Remember to call `plt.show()` to display the plots.
Initialize `fig, ax = plt.subplots()` before calling plotting functions like `hist(ax, ...)`.
Use `df.select('column_name')` to pass only the relevant numerical column to the plotting function, e.g., `hist(ax, df.select('my_numeric_column'))`.Always call `plt.show()` after generating plots. For non-interactive environments, consider saving the figure: `plt.savefig('my_plot.png')` or configuring a non-interactive backend like `agg` (though this won't show plots interactively). For Jupyter/IPython, ensure `%matplotlib inline` or `%matplotlib notebook` is set.Be aware of potential compatibility issues with very recent PySpark versions. For critical new projects, consider alternative, more actively maintained PySpark visualization libraries if available or roll your own using PySpark's RDD/DataFrame operations combined with Matplotlib/Seaborn.
Ensure you call `plt.show()` after generating your plot. If running in an interactive environment (like Jupyter), use `%matplotlib inline` or `%matplotlib notebook`. Otherwise, save the figure with `plt.savefig('plot.png')`.Ensure the column you are plotting is of a numeric type (IntegerType, FloatType, DoubleType). Cast the column if necessary: `df.withColumn('numeric_col', df['string_col'].cast('double')).select('numeric_col')`.PySpark-dist-explore functions are standalone. Instead of `df.plot()`, use `hist(ax, df.select('column_name'))` or `density_plot(ax, df.select('column_name'))` after initializing `fig, ax = plt.subplots()`.Make sure to initialize your SparkSession: `from pyspark.sql import SparkSession; spark = SparkSession.builder.appName("MyApp").getOrCreate()`.