0

I have created a dataframe by reading a csv file as follows:

out_df = spark.read.csv(r"group_number_out.csv", header=True, inferSchema=True)
out_df = out_df.withColumn("dates", F.col('dates').cast(DateType()))
out_df.show()

Now I want to concat the dataframe name(out_df) with a variable user_name which is an input.

Let user_name = 'tom'

So, now the required output is something like tom_out_df which should be same as out_df.

That is tom_out_df = out_df.

chandu
  • 1
  • 1
  • 1
    Does this answer your question? [How do I create variable variables?](https://stackoverflow.com/questions/1373164/how-do-i-create-variable-variables) – dallonsi Oct 11 '21 at 08:23
  • 3
    That is really bad idea. [Keep data out of your variable names.](http://nedbatchelder.com/blog/201112/keep_data_out_of_your_variable_names.html) Check https://stackoverflow.com/q/1373164/4046632 and http://stupidpythonideas.blogspot.com/2013/05/why-you-dont-want-to-dynamically-create.html – buran Oct 11 '21 at 08:26

0 Answers0