<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_pandas_dataframe(self):
 """Convert a binary quadratic model to pandas DataFrame format. Returns: :class:`pandas.DataFrame`: The binary quadratic model as a DataFrame. The DataFrame has binary vartype. The rows and columns are labeled by the variables in the binary quadratic model. Notes: The DataFrame representation of a binary quadratic model only makes sense for binary models. For a binary sample x, the energy of the model is given by: .. math:: E(x) = x^T Q x The offset is dropped when converting to a pandas DataFrame. Examples: This example converts a binary quadratic model to pandas DataFrame format. a b c a 1.1 0.5 0.0 b 0.0 -1.0 1.5 c 0.0 0.0 0.5 """

        import pandas as pd

        try:
            variable_order = sorted(self.linear)
        except TypeError:
            variable_order = list(self.linear)

        return pd.DataFrame(self.to_numpy_matrix(variable_order=variable_order),
                            index=variable_order,
                            columns=variable_order)