Our setting is PySpark. Suppose I create a dataframe df using the spark.read.csv function, i.e.
df = spark.read.csv("directory/name_file.csv")
Now I need a way to extract "name_file" without of course copying and pasting by hand. In other words, I want a spark list or dataframe that only contains the string "name_file".
Please, provide only a solution that involves PySpark SQL or Python code compatible with PySpark.
The problem seems straightforward, but I spent a lot of time looking for a solution without getting anything.