title: Pandas DataFrame.apply: create new column with data from two columns
body: <p>I have a DataFrame (df) like this:</p>
  
  <pre><code>PointID  Time                 geojson
  ----     ----                 ----     
  36F      2016-04-01T03:52:30  {'type': 'Point', 'coordinates': [3.961389, 43.123]}
  36G      2016-04-01T03:52:50  {'type': 'Point', 'coordinates': [3.543234, 43.789]}
  </code></pre>
  
  <p>The geojson column contains data in geoJSON format (esentially, a Python dict).</p>
  
  <p>I want to create a new column in geoJSON format, which includes the time coordinate. In other words, I want to inject the time information into the geoJSON info.</p>
  
  <p>For a single value, I can successfully do:</p>
  
  <pre><code>oldjson = df.iloc[0]['geojson']
  newjson = [df['coordinates'][0], df['coordinates'][1], df.iloc[0]['time'] ]
  </code></pre>
  
  <p>For a single parameter, I successfully used dataFrame.apply in combination with lambda (thanks to SO: <a href="https://stackoverflow.com/questions/44566744/pandas-dataframe-convert-wkt-into-geojson-in-a-new-column-using-lambda-function">related question</a></p>
  
  <p>But now, I have two parameters, and I want to use it on the whole DataFrame. As I am not confident with the .apply syntax and lambda, I do not know if this is even possible. I would like to do something like this:</p>
  
  <pre><code>def inject_time(geojson, time):
  """
  Injects Time dimension into geoJSON coordinates. Expects  a dict in geojson POINT format.
  """
  geojson['coordinates'] = [geojson['coordinates'][0], geojson['coordinates'][1], time]
  return geojson
  
  
  df["newcolumn"] = df["geojson"].apply(lambda x: inject_time(x, df['time'])))
  </code></pre>
  
  <p>...but that does not work, because the function would inject the whole series.</p>
  
  <p>EDIT:
  I figured that the format of the timestamped geoJSON should be something like this:</p>
  
  <pre><code>TimestampedGeoJson({
              "type": "FeatureCollection",
                 "features": [
                   {
                     "type": "Feature",
                     "geometry": {
                       "type": "LineString",
                       "coordinates": [[-70,-25],[-70,35],[70,35]],
                       },
                     "properties": {
                       "times": [1435708800000, 1435795200000, 1435881600000]
                       }
                     }
                   ]
                 })
  </code></pre>
  
  <p>So the time element is in the properties element, but this does not change the problem much.</p>