def filter_by_months(self, months):
_filt_values = []<EOL>_filt_datetimes = []<EOL>for i, d in enumerate(self.datetimes):<EOL><INDENT>if d in months:<EOL><INDENT>_filt_datetimes.append(d)<EOL>_filt_values.append(self._values[i])<EOL><DEDENT><DEDENT>_filt_header = self.header.duplicate()<EOL>return MonthlyCollection(_filt_header, _filt_values, _filt_datetimes)<EOL>
Filter the Data Collection based on a list of months of the year (as integers).

        Args:
           months: A List of months of the year [1..12]

        Return:
            A new Data Collection with filtered data