<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary(self, Nbest=5, lw=2, plot=True):
 """Plots the distribution of the data and Nbest distribution """

        if plot:
            pylab.clf()
            self.hist()
            self.plot_pdf(Nbest=Nbest, lw=lw)
            pylab.grid(True)

        Nbest = min(Nbest, len(self.distributions))
        try:
            names = self.df_errors.sort_values(
                    by="sumsquare_error").index[0:Nbest]
        except:
            names = self.df_errors.sort("sumsquare_error").index[0:Nbest]
        return self.df_errors.loc[names]