<commit_before>import numpy as np

from break4w.question import Question


class Continous(Question):

    def __init__(self, name, description, dtype=None, unit=None, limits=None,
                 rounding=None, clean_name=None, mimarks=False, ontology=None,
                 ebi_required=False, qiita_required=False, missing=None):
        """A Question object with continous responses

        Parameters
        ----------
        name : str
            The name of column where the group is stored
        description : str
            A brief description of the data contained in the question
        unit : str, optional
            The unit of measure for the data type, if relevant. Units
            are awesome, and should be included whenever relevant.
        limits : two-elemant iterable
            The range of values pertinant to analysis.
        rounding : int, optional
            The number of digits to which results should be rounded.
        clean_name : str, optional
            A nicer version of the way the column should be named.
        mimarks : bool, optional
            If the question was a mimarks standard field
        ontology : str, optional
            The type of ontology, if any, which was used in the field value.
        ebi_required : bool, optional
            Describes whether the question is required by EBI
        qiita_required : bool, optional
            Is the question req,uired by qiita
        missing : str, list, optional
            Acceptable missing values

        Raises
        ------
        ValueError
            When the values in `limits` are not expressed in order (i.e.
            the first value is larger than the second)
        """

        if dtype is None:
            dtype = float

        Question.__init__(self,
                          name=name,
                          description=description,
                          dtype=dtype,
                          clean_name=clean_name,
                          free_response=False,
                          mimarks=mimarks,
                          ontology=ontology,
                          qiita_required=qiita_required,
                          ebi_required=ebi_required,
                          missing=missing
                          )
        self.unit = unit
        if limits is not None:
            lower, upper = limits
            if lower > upper:
                raise ValueError('The lower limit cannot be greater than '
                                 'the upper!')
        else:
            lower, upper = (None, None)

        self.lower = lower
        self.upper = upper
        self.type = 'Continous'
        self.rounding = rounding

    def analysis_drop_outliers(self, map_):
        """Removes datapoints outside of the default limits.

        Parameters
        ----------
        map_ : DataFrame
            A pandas dataframe containing the column described by the question
            name.

        Raises
        ------
        ValueError
            If the column identified by the question object is not part of the
            supplied DataFrame.
        """<commit_msg>updates argument to match question<commit_after>import numpy as np

from break4w.question import Question


class Continous(Question):

    def __init__(self, name, description, dtype=None, unit=None, limits=None,
                 rounding=None, clean_name=None, mimarks=False, ontology=None,
                 missing=None, blanks=None, colormap=None):
        """A Question object with continous responses

        Parameters
        ----------
        name : str
            The name of column where the group is stored
        description : str
            A brief description of the data contained in the question
        unit : str, optional
            The unit of measure for the data type, if relevant. Units
            are awesome, and should be included whenever relevant.
        limits : two-elemant iterable
            The range of values pertinant to analysis.
        rounding : int, optional
            The number of digits to which results should be rounded.
        clean_name : str, optional
            A nicer version of the way the column should be named. This can be
            used for display in figures. If nothing is provided, the column
            name will be coverted to a title by replacing an underscores with
            spaces and converting to title case.
        mimarks : bool, optional
            If the question was a mimarks standard field
        ontology : str, optional
            The type of ontology, if any, used to answer the question. An
            ontology provides a consistent, structured vocabulary. A list
            of ontologies can be found at https://www.ebi.ac.uk/ols/ontologies
        missing : str, list, optional
            Acceptable missing values. Missing values will be used to validate
            all values in the column. Specified missing values can also be
            ignored during analysis if correctly specified.
        blanks: str, list, optional
            Value to represent experimental blanks, if relevent.
        colormap: str, iterable, optional
            The colors to use when plotting the data. This can be a matplotlib
            colormap object or a string describing a matplotlib compatable
            colormap (i.e. `'RdBu'`).

        Raises
        ------
        ValueError
            When the values in `limits` are not expressed in order (i.e.
            the first value is larger than the second)
        """

        if dtype is None:
            dtype = float

        Question.__init__(self,
                          name=name,
                          description=description,
                          dtype=dtype,
                          clean_name=clean_name,
                          mimarks=mimarks,
                          ontology=ontology,
                          missing=missing,
                          blanks=blanks,
                          colormap=colormap,
                          )
        self.unit = unit
        if limits is not None:
            lower, upper = limits
            if lower > upper:
                raise ValueError('The lower limit cannot be greater than '
                                 'the upper!')
        else:
            lower, upper = (None, None)

        self.lower = lower
        self.upper = upper
        self.type = 'Continous'
        self.rounding = rounding

    def analysis_drop_outliers(self, map_):
        """
        Removes datapoints outside of the specified limits

        Parameters
        ----------
        map_ : DataFrame
            A pandas dataframe containing the column described by the question
            name.

        Raises
        ------
        ValueError
            If the column identified by the question object is not part of the
            supplied DataFrame.
        """
{'fraction_non_alphanumeric': 0.0547886108714409, 'fraction_numerical': 0.0002876042565429968, 'mean_word_length': 1.4946197991391679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2443849', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1563, 'n_words': 659}