This solution is also an approach that uses less code, avoids serialization to RDD and is likely easier to understand:

from pyspark.sql.types import IntegerType

# notice the variable name (more below)
mylist = [1, 2, 3, 4]

# notice the parens after the type name
spark.createDataFrame(mylist, IntegerType()).show()

NOTE: About naming your variable list: the term list is a Python builtin function and as such, it is strongly recommended that we avoid using builtin names as the name/label for our variables because we end up overwriting things like the list() function. When prototyping something fast and dirty, a number of folks use something like: mylist.

Answer from E. Ducateme on Stack Overflow
🌐
Spark By {Examples}
sparkbyexamples.com › home › pyspark › pyspark create dataframe from list
PySpark Create DataFrame from List - Spark By {Examples}
May 6, 2026 - In PySpark, we often need to create a DataFrame from a list, In this article, I will explain creating DataFrame and RDD from List using PySpark examples.
🌐
Medium
medium.com › @andrew.w.gross › simple-lists-to-dataframes-for-pyspark-d6b608f739fc
Simple lists to dataframes for PySpark | by Andrew Gross | Medium
November 30, 2023 - import pandas as pd import pyspark ... -> pyspark.sql.DataFrame: """ Converts a python list to a dataframe with the given column name Pass unique=True to only get distinct values....
🌐
RoseIndia
roseindia.net › bigdata › pyspark › pyspark-read-list-into-dataframe.shtml
With PySpark read list into Data Frame
The createDataFrame() function is used to create data frame from RDD, a list or pandas DataFrame.
🌐
Adlersantos
adlersantos.com › articles › 18 › transforming-python-list-to-spark-dataframe
Transforming Python Lists into Spark Dataframes - Writings
""" data = spark.read.json('some/path/or/url') data.createOrReplaceTempView("table") # Apply some SQL query to the data, which results in a DataFrame df = session.sql(""" select col1, col2, sum(col3) from table where col4 = 'some_val' group by col1, col2 """) # Write the query results to a target in your desired format (say, JSON) df.write.json('target/path/') The example above works conveniently if you can easily load your data as a dataframe using PySpark’s built-in functions. But sometimes you’re in a situation where your processed data ends up as a list of Python dictionaries, say when you weren’t required to use spark.read and/or session.sql.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › pyspark create dataframe from list
PySpark Create DataFrame from List | Working | Examples
April 11, 2023 - PySpark Create DataFrame from List is a way of creating of Data frame from elements in List in PySpark. This conversion includes the data that is in the List into the data frame which further applies all the optimization and operations in PySpark ...
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Kontext
kontext.tech › home › blogs › spark & pyspark › pyspark: convert python array/list to spark data frame
PySpark: Convert Python Array/List to Spark Data Frame - Kontext Labs
August 17, 2020 - from pyspark.sql import SparkSession from pyspark.sql.types import ArrayType, StructField, StructType, StringType, IntegerType appName = "PySpark Example - Python Array/List to Spark Data Frame" master = "local" # Create Spark session spark = SparkSession.builder \ .appName(appName) \ .master(master) \ .getOrCreate() # List data = [('Category A', 100, "This is category A"), ('Category B', 120, "This is category B"), ('Category C', 150, "This is category C")] # Create a schema for the dataframe schema = StructType([ StructField('Category', StringType(), True), StructField('Count', IntegerType(), True), StructField('Description', StringType(), True) ]) # Convert list to RDD rdd = spark.sparkContext.parallelize(data) # Create data frame df = spark.createDataFrame(rdd,schema) print(df.schema) df.show()
Find elsewhere
🌐
Statology
statology.org › home › pyspark: how to create dataframe from list (with examples)
PySpark: How to Create DataFrame from List (With Examples)
November 8, 2023 - The resulting DataFrame contains one column of integer values that came directly from the values in the list. Note: In this example we specified that the column should be an integer, but you could instead use StringType, FloatType, etc. to specify a different data type. Refer to the PySpark documentation for a complete list of data types.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › pyspark list to dataframe
PySpark list to dataframe | Learn the Wroking of PySpark list to dataframe
March 31, 2023 - PYSPARK LIST TO DATAFRAME is a technique in a Data frame that converts a List in PySpark to a Data frame. This conversion allows the conversion that makes the analysis of data easier in PySpark.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Medium
vengateswaran.medium.com › different-approaches-to-convert-python-list-to-column-in-pyspark-dataframe-42b17403a1fe
Different Approaches to Convert Python List to Column in PySpark DataFrame | by Vengateswaran Arunachalam | Medium
April 5, 2024 - from pyspark.sql import SparkSession # Initialize SparkSession spark = SparkSession.builder \ .appName("Create DataFrame from Python list") \ .getOrCreate() # Define your Python list data = ["USA", "India", "Australia"] # Example Python list # Convert the Python list to an RDD rdd = spark.sparkContext.parallelize(data)
🌐
GeeksforGeeks
geeksforgeeks.org › python › pyspark-create-dataframe-from-list
PySpark - Create DataFrame from List - GeeksforGeeks
May 30, 2021 - # importing module import pyspark # importing sparksession from # pyspark.sql module from pyspark.sql import SparkSession # creating sparksession and giving # an app name spark = SparkSession.builder.appName('sparkdf').getOrCreate() # list of college data with two lists data = [["java", "dbms", "python"], ["OOPS", "SQL", "Machine Learning"]] # giving column names of dataframe columns = ["Subject 1", "Subject 2", "Subject 3"] # creating a dataframe dataframe = spark.createDataFrame(data, columns) # show data frame dataframe.show()
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily create a pyspark dataframe from a list
How To Easily Create A PySpark DataFrame From A List
January 3, 2026 - The standard procedure involves establishing a SparkSession (or an older SparkContext), defining the data as a Python list, and then invoking the crucial createDataFrame() method.
🌐
GeeksforGeeks
geeksforgeeks.org › converting-a-pyspark-dataframe-column-to-a-python-list
Converting a PySpark DataFrame Column to a Python List - GeeksforGeeks
December 1, 2021 - Let's see how can we convert a data frame column to row name or index in Pandas. Create a dataframe first with dict of lists.  Python3 # importing pandas as pd import pandas as pd # Creating a dict of lists data = {'Name':["Akas ...
🌐
Arab Psychology
scales.arabpsychology.com › psychological scales › how can i create a dataframe from a list in pyspark?
How Can I Create A DataFrame From A List In PySpark?
April 1, 2024 - Creating a DataFrame from a list in PySpark is a simple and efficient process. First, the list needs to be converted into a PySpark RDD (Resilient Distributed Dataset) using the “parallelize” function.
🌐
Medium
chiragshilwant102.medium.com › converting-a-pyspark-dataframe-column-to-a-python-list-8a1d3942df07
Converting a PySpark DataFrame Column to a Python List | by Chirag Shilwant | Medium
July 6, 2021 - For converting the columns of PySpark DataFrame to a Python List, we first require a PySpark Dataframe. We have seen how we can Create a PySpark Dataframe.
🌐
Kanaries
docs.kanaries.net › topics › PySpark › pyspark-tolist
PySpark DataFrame to List: 5 Best Ways to Convert Rows and Columns to Python Lists – Kanaries
One common need—especially during debugging, exporting, or data transformation—is converting a PySpark DataFrame into a Python list. Although PySpark does not provide a built-in .tolist() method like Pandas, there are several reliable ways to achieve the same result depending on dataset ...