@classmethod
def from_dataframe(cls, df, geom_col='geometry', idVariable=None, ids=None,
    id_order=None, **kwargs):
    """
        Construct a weights object from a pandas dataframe with a geometry
        column. This will cast the polygons to PySAL polygons, then build the W
        using ids from the dataframe.

        Parameters
        ----------
        df          : DataFrame
                      a :class: `pandas.DataFrame` containing geometries to use
                      for spatial weights
        geom_col    : string
                      the name of the column in `df` that contains the
                      geometries. Defaults to `geometry`
        idVariable  : string
                      the name of the column to use as IDs. If nothing is
                      provided, the dataframe index is used
        ids         : list
                      a list of ids to use to index the spatial weights object.
                      Order is not respected from this list.
        id_order    : list
                      an ordered list of ids to use to index the spatial weights
                      object. If used, the resulting weights object will iterate
                      over results in the order of the names provided in this
                      argument. 

        See Also
        --------
        :class:`libpysal.weights.weights.W`
        :class:`libpysal.weights.contiguity.Rook`
        """
    if id_order is not None:
        if id_order is True and (idVariable is not None or ids is not None):
            id_order = list(df.get(idVariable, ids))
        else:
            id_order = df.get(id_order, ids)
    elif idVariable is not None:
        ids = df.get(idVariable).tolist()
    elif isinstance(ids, str):
        ids = df.get(ids).tolist()
    return cls.from_iterable(df[geom_col].tolist(), ids=ids, id_order=
        id_order, **kwargs)
