title: Convert Points to Lines Geopandas
body: <p>Hello I am trying to convert a list of X and Y coordinates to lines. I want to mapped this data by <code>groupby</code> the IDs and also by time. My code executes successfully as long as I <code>grouby</code> one column, but two columns is where I run into errors. I referenced to this <a href="https://gis.stackexchange.com/questions/202190/turn-a-geodataframe-of-x-y-coordinates-into-linestrings-using-groupby">question</a>.</p>
  
  <p>Here's some sample data:</p>
  
  <pre><code>ID  X           Y           Hour
  1   -87.78976   41.97658    16
  1   -87.66991   41.92355    16
  1   -87.59887   41.708447   17
  2   -87.73956   41.876827   16
  2   -87.68161   41.79886    16
  2   -87.5999    41.7083     16
  3   -87.59918   41.708485   17
  3   -87.59857   41.708393   17
  3   -87.64391   41.675133   17
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>df = pd.read_csv("snow_gps.csv", sep=';')
  
  #zip the coordinates into a point object and convert to a GeoData Frame
  geometry = [Point(xy) for xy in zip(df.X, df.Y)]
  geo_df = GeoDataFrame(df, geometry=geometry)
  
  # aggregate these points with the GrouBy
  geo_df = geo_df.groupby(['track_seg_point_id', 'Hour'])['geometry'].apply(lambda x: LineString(x.tolist()))
  geo_df = GeoDataFrame(geo_df, geometry='geometry')
  </code></pre>
  
  <p>Here is the error: ValueError: LineStrings must have at least 2 coordinate tuples</p>
  
  <p>This is the final result I am trying to get:</p>
  
  <pre><code>ID          Hour     geometry
  1           16       LINESTRING (-87.78976 41.97658, -87.66991 41.9... 
  1           17       LINESTRING (-87.78964000000001 41.976634999999... 
  1           18       LINESTRING (-87.78958 41.97663499999999, -87.6... 
  2           16       LINESTRING (-87.78958 41.976612, -87.669785 41... 
  2           17       LINESTRING (-87.78958 41.976624, -87.66978 41.... 
  3           16       LINESTRING (-87.78958 41.97666, -87.6695199999... 
  3           17       LINESTRING (-87.78954 41.976665, -87.66927 41.... 
  </code></pre>
  
  <p>Please any suggestions or ideas would be great on how to groupby multiple parameters.</p>