PySpark Data Transformation (Practice)
- Data Cleaning & Type Casting: Utilizing
trim()to clear malformed string whitespaces,try_cast()for type-safe numeric conversion, andto_date()with specific date formats (e.g.,"yyyy/MM/dd") to standardize timelines. - Imputation & Missing Values: Implementing
when().otherwise()conditionals andcoalesce()functions to safely replace empty strings ("") ornullrecords with default values like"Unknown"or"Online". - Advanced Joining Techniques: Performing multi-table Left Joins using DataFrame Aliases and executing Non-Equi Joins based on open conditional logic (e.g., matching records where an
order_datefallsBETWEENpromo start and end dates). - Window Analytical Functions: Defining structured data partitions using
Window.partitionBy()andorderBy()to calculaterow_number()for data deduplication and rollingsum()for dynamic metrics like Lifetime Value (LTV). - Complex Data Types & Aggregations: Grouping large datasets via
groupBy()to compute multi-metric aggregations likecountDistinct()andcollect_list(), and wrapping multi-dimensional attributes into single nested JSON objects usingstruct().
- Content: Core PySpark data cleaning, data imputation, and categorical aggregations.
- Focus: Hands-on practice with schema-based DataFrame creation, handling empty/null fields using
when/otherwise, type casting, and extracting multi-metric array lists from grouped data.
- Content: An end-to-end analytical ETL pipeline utilizing Spark SQL and analytical functions.
- Focus: Date-between Joins | Window Functions (row_number, sum) | Nested struct() | Delta Table Outputs.