code: def test_to_pandas():
      class SomeDataType:
          def to_pandas(self):
              return pd.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3]})
  
      data = SomeDataType()
      p1 = ggplot(data, aes("x", "y")) + geom_point()
      p2 = data >> ggplot(aes("x", "y")) + geom_point()
      assert p1 == "to_pandas"
      assert p2 == "to_pandas"
  
imports: from copy import deepcopy
  import numpy
  import pandas
  import pytest
  from plotnine import aes, after_scale, after_stat, annotate, coord_trans, facet_null, geom_bar, geom_histogram, geom_line, geom_point, ggplot, ggtitle, guides, labs, lims, scale_x_continuous, stage, stat_identity, theme, theme_gray, xlab, xlim, ylab
  from plotnine.exceptions import PlotnineError, PlotnineWarning
  from plotnine.mapping.aes import is_valid_aesthetic
label_desc: Use image node_id 21 for calling a global function with example usage: test_to_pandas() and returns: pd