示例#1
0
    def multiindex(self, indexnames=None):
        """Create a `pandas.MultiIndex` version of results.

        :Example:

        >>> d = corpora.interrogate({F: 'compound', GL: '^risk'}, show=L)
        >>> d.keys()
            ['CHT', 'WAP', 'WSJ']
        >>> d['CHT'].results
            ....  health  cancer  security  credit  flight  safety  heart
            1987      87      25        28      13       7       6      4
            1988      72      24        20      15       7       4      9
            1989     137      61        23      10       5       5      6
        >>> d.multiindex().results
            ...               health  cancer  credit  security  downside  
            Corpus Subcorpus                                             
            CHT    1987           87      25      13        28        20 
                   1988           72      24      15        20        12 
                   1989          137      61      10        23        10                                                      
            WAP    1987           83      44       8        44        10 
                   1988           83      27      13        40         6 
                   1989           95      77      18        25        12 
            WSJ    1987           52      27      33         4        21 
                   1988           39      11      37         9        22 
                   1989           55      47      43         9        24 

        :returns: A :class:`corpkit.interrogation.Interrogation`
        """
        from corpkit.other import make_multi
        return make_multi(self, indexnames=indexnames)
示例#2
0
    def multiindex(self, indexnames=None):
        """Create a `pandas.MultiIndex` object from slash-separated results.

        :Example:

        >>> data = corpus.interrogate({W: 'st$'}, show=[L, F])
        >>> data.results
            ..  just/advmod  almost/advmod  last/amod 
            01           79             12          6 
            02          105              6          7 
            03           86             10          1 
        >>> data.multiindex().results
            Lemma       just almost last first   most 
            Function  advmod advmod amod  amod advmod 
            0             79     12    6     2      3 
            1            105      6    7     1      3 
            2             86     10    1     3      0                                   

        :param indexnames: provide custom names for the new index, or leave blank to guess.
        :type indexnames: `list` of strings

        :returns: :class:`corpkit.interrogation.Interrogation`, with 
                  `pandas.MultiIndex` as 
        :py:attr:`~corpkit.interrogation.Interrogation.results` attribute
        """

        from corpkit.other import make_multi
        return make_multi(self, indexnames=indexnames)
示例#3
0
    def multiindex(self, indexnames=None):
        """Create a `pandas.MultiIndex` object from slash-separated results.

        :Example:

        >>> data = corpus.interrogate({W: 'st$'}, show=[L, F])
        >>> data.results
            ..  just/advmod  almost/advmod  last/amod 
            01           79             12          6 
            02          105              6          7 
            03           86             10          1 
        >>> data.multiindex().results
            Lemma       just almost last first   most 
            Function  advmod advmod amod  amod advmod 
            0             79     12    6     2      3 
            1            105      6    7     1      3 
            2             86     10    1     3      0                                   

        :param indexnames: provide custom names for the new index, or leave blank to guess.
        :type indexnames: `list` of strings

        :returns: :class:`corpkit.interrogation.Interrogation`, with 
                  `pandas.MultiIndex` as 
        :py:attr:`~corpkit.interrogation.Interrogation.results` attribute
        """

        from corpkit.other import make_multi
        return make_multi(self, indexnames=indexnames)
示例#4
0
    def multiindex(self, indexnames = False):
        """Create a ``pd.MultiIndex`` version of results.

        :param indexnames: provide custom names for the new index
        :type indexnames: list of strings

        :returns: A :class:`corpkit.interrogation.Interrogation`
        """
        from corpkit.other import make_multi
        return make_multi(self, indexnames = indexnames)
示例#5
0
    def multiindex(self, indexnames = False):
        """Create a `pd.MultiIndex` object from slash-separated results.

           >>> mi = data.multiindex()

        :param indexnames: provide custom names for the new index
        :type indexnames: list of strings

        :returns: :class:`corpkit.interrogation.Interrogation`, with ``pd.MultiIndex`` as :py:attr:`~corpkit.interrogation.Interrogation.results` attribute
        """

        from corpkit.other import make_multi
        return make_multi(self, indexnames = indexnames)