'using 2 pyspark dataframes for conditional statement and to run a funtion

I have 2 tables in pyspark dataframes. dataframe1 having 10 rows with field say "ID" is unique dataframe2 having more rows with "ID" (not unique). I want to run a chisquare test function for dataframe2 for each "ID" dataframe1



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source