title: Accessing row in geometry in geoseries
body: <p>I've created two geodataframes and I'm trying to find the shortest distance between every point in one geodataframe to any point in the other geodataframe based on the answer <a href="https://gis.stackexchange.com/questions/222315/geopandas-find-nearest-point-in-other-dataframe">here</a>. </p>
  
  <p>However, even though I think I've created a geometry column I can't access the rows. I get this error:</p>
  
  <pre><code>AttributeError: ("'Series' object has no attribute 'geometry'", u'occurred at index 0')
  </code></pre>
  
  <p>nameofgeodataframe.head() returns: </p>
  
  <pre><code>   node  x_coord  y_coord   Coordinates1
  0     0        0      258  POINT (0 258)
  1     1        0      259  POINT (0 259)
  2     2        0      260  POINT (0 260)
  3     3        0      261  POINT (0 261)
  4     4        0      262  POINT (0 262)
  </code></pre>
  
  <p>This is my very inelegant script.</p>
  
  <pre><code>f = h5py.File("temp_bin2x_outer_tagged.hdf", "r")
  data = f["MDF/images/0/image"]
  my_test = data[171, :, :]
  val = filter.threshold_otsu(my_test)
  binary = np.where(my_test &gt; val, 1, 0)
  outskel = skeletonize(binary)
  x, y = np.where(outskel&gt;0)
  y_coord = y.tolist()
  x_coord = x.tolist()
  index = list(range(0,(len(x_coord))))
  df = pd.DataFrame({"y_coord": y_coord, "x_coord": x_coord, "node": index})
  df['Coordinates1'] = list(zip(df.x_coord, df.y_coord))
  df['Coordinates1'] = df['Coordinates1'].apply(Point)
  outer = geopandas.GeoDataFrame(df, geometry='Coordinates1')
  
  f2 = h5py.File("temp_bin2x_inner_tagged.hdf", "r")
  data2 = f2["MDF/images/0/image"]
  my_test2 = data2[211, :, :]
  val2 = filter.threshold_otsu(my_test2)
  binary2 = np.where(my_test2 &gt; val2, 1, 0)
  binary2 = np.where(my_test2 &gt; val2, 1, 0)
  inskel = skeletonize(binary2)
  x2, y2 = np.where(inskel&gt;0)
  y_coord2 = y2.tolist()
  x_coord2 = x2.tolist()
  index2 = list(range(0,(len(x_coord2))))
  df2 = pd.DataFrame({"y_coord2": y_coord2, "x_coord2": x_coord2, "node": index2})
  df2['Coordinates'] = list(zip(df2.x_coord2, df2.y_coord2))
  df2['Coordinates'] = df2['Coordinates'].apply(Point)
  inner = geopandas.GeoDataFrame(df2, geometry='Coordinates')
  
  from shapely.ops import nearest_points
  pts3 = inner.geometry.unary_union
  def near(point, pts=pts3):
       nearest = inner.geometry == nearest_points(point, pts)[1]
       return inner[nearest].node.get_values()[0]
  outer['Nearest'] = outer.apply(lambda row: near(row.geometry), axis=1)
  </code></pre>
  
  <p>Am I misunderstanding how a geodataframe is constructed?</p>
  
  <p>Thank you so much, any help would be great!</p>