def plot_facet(self, data, color, **kwargs):
x = kwargs.get("x")
y = kwargs.get("y")
levels_x = kwargs.get("levels_x")
levels_y = kwargs.get("levels_y")
#num = []
#date = []
#time = data[self._time_column]
#num = data[self._time_column].apply(self.convert_to_datetime)
#date = data[self._time_column].apply(self.convert_to_timeseries)
#if pd.isnull(num).sum() <= pd.isnull(date).sum():
#data[self._time_column] = num
#else:
#data[self._time_column] = date
#data.dropna(inplace=True)
#if len(self._groupby) == 2:
#ct = pd.crosstab(data[self._time_column], data[self._groupby[0]])
#ct = ct.reindex_axis(self._levels[0], axis=1).fillna(0)
#ct = ct[pd.notnull(ct.index)]
#else:
#ct = pd.crosstab(
#data[self._time_column],
#pd.Series([""] * len(self._table[self._time_column]), name=""))
## percentage area plot:
## if there is only one grouping variable (the time column),
## the cross table produces a Series, not a data frame. It
## isn't really very informative to plot it, but we provide
## for this special case anyway_
#if type(ct) == pd.Series:
#ct = ct.apply(lambda x: 100)
#else:
#ct = ct.apply(lambda x: (100 * x) / sum(x), axis=1)
#ct.plot(kind="area", ax=plt.gca(), stacked=True, color=self.get_palette(), **kwargs)
评论列表
文章目录