title: Timezone conversion with pyspark from timestamp and country
body: <p>I'm trying to convert UTC date to date with local timezone (using the country) with PySpark.
  I have the country as string and the date as timestamp</p>
  
  <p>So the input is :</p>
  
  <p><code>date = Timestamp('2016-11-18 01:45:55') # type is pandas._libs.tslibs.timestamps.Timestamp</code></p>
  
  <p><code>country = "FR" # Type is string</code></p>
  
  <pre><code>import pytz
  import pandas as pd
  
  def convert_date_spark(date, country):
      timezone = pytz.country_timezones(country)[0]
  
      local_time = date.replace(tzinfo = pytz.utc).astimezone(timezone)
      date, time = local_time.date(), local_time.time()
  
      return pd.Timestamp.combine(date, time)
  
  # Then i'm creating an UDF to give it to spark
  
  convert_date_udf = udf(lambda x, y : convert_date_spark(x, y), TimestampType())
  </code></pre>
  
  <p>Then I use it in the function that feeds spark :</p>
  
  <pre><code>data = data.withColumn("date", convert_date_udf(data["date"], data["country"]))
  </code></pre>
  
  <p>I got the following error :</p>
  
  <blockquote>
    <p>TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'</p>
  </blockquote>
  
  <p><strong>The expected output is the date with the same format</strong> </p>
  
  <p>As tested with python, the _convert_date_spark_ functions works but this is not working in pyspark</p>
  
  <p><a href="https://i.stack.imgur.com/0Zndj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Zndj.png" alt="enter image description here"></a></p>
  
  <p>Could you please help me finding a solution for this ? </p>
  
  <p>Thanks </p>