spark-examples / pyspark-examples

Pyspark RDD, DataFrame and Dataset Examples in Python language
https://sparkbyexamples.com
1.17k stars 895 forks source link

List of strings is not a supported format to create dataframe. #18

Open MdShahidAfridiP opened 8 months ago

MdShahidAfridiP commented 8 months ago

https://github.com/spark-examples/pyspark-examples/blob/0ae16f1064938140ba82c12841053c8c2e7bdd29/currentdate.py#L21

ahmedkadeh commented 4 months ago

Hello, you just need to create the DF like that :

from pyspark.sql import SparkSession
from pyspark.sql.types import StringType

spark = SparkSession.builder.appName('SparkByExamples.com').getOrCreate()

df = spark.createDataFrame(list('1'), StringType())