Skip to content

Convert SurveyMonkey respones in JSON to a PySpark DataFrame

License

Notifications You must be signed in to change notification settings

historized/spark-surveymonkey

Repository files navigation

spark-surveymonkey

Convert SurveyMonkey respones in JSON to a PySpark DataFrame

Usage

from spark_surveymonkey import transform_survey

df = transform_survey(spark_session, 'path/to/responses/', 'path/to/details.json')

Function signature:

def transform_survey(spark_session: SparkSession,
                     survey_responses: str,
                     survey_details: Union[str, Dict[str, str]]) -> DataFrame:
    """Convert SurveyMonkey responses in JSON to a PySpark `DataFrame`.

    Args:
        spark_session: A `SparkSession` object.
        survey_responses: Path to directory containing JSON files.
            Files retrieved from API endpoint `surveys/{survey_id}/responses/bulk`.
        survey_details: Path to JSON file, or `dict` of JSON file.
            File retrieved from API endpoint `surveys/{survey_id}/details`.

    Returns:
        `DataFrame`: Survey responses with 1 row per response.
    """

About

Convert SurveyMonkey respones in JSON to a PySpark DataFrame

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages