Python pandas.util._validators.validate_axis_style_args() Examples

The following are 7 code examples of pandas.util._validators.validate_axis_style_args(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.util._validators , or try the search function .
Example #1
Source File: panel.py    From recruit with Apache License 2.0 6 votes vote down vote up
def reindex(self, *args, **kwargs):
        major = kwargs.pop("major", None)
        minor = kwargs.pop('minor', None)

        if major is not None:
            if kwargs.get("major_axis"):
                raise TypeError("Cannot specify both 'major' and 'major_axis'")
            kwargs['major_axis'] = major
        if minor is not None:
            if kwargs.get("minor_axis"):
                raise TypeError("Cannot specify both 'minor' and 'minor_axis'")

            kwargs['minor_axis'] = minor
        axes = validate_axis_style_args(self, args, kwargs, 'labels',
                                        'reindex')
        kwargs.update(axes)
        kwargs.pop('axis', None)
        kwargs.pop('labels', None)

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", FutureWarning)
            # do not warn about constructing Panel when reindexing
            result = super(Panel, self).reindex(**kwargs)
        return result 
Example #2
Source File: panel.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def reindex(self, *args, **kwargs):
        major = kwargs.pop("major", None)
        minor = kwargs.pop('minor', None)

        if major is not None:
            if kwargs.get("major_axis"):
                raise TypeError("Cannot specify both 'major' and 'major_axis'")
            kwargs['major_axis'] = major
        if minor is not None:
            if kwargs.get("minor_axis"):
                raise TypeError("Cannot specify both 'minor' and 'minor_axis'")

            kwargs['minor_axis'] = minor
        axes = validate_axis_style_args(self, args, kwargs, 'labels',
                                        'reindex')
        kwargs.update(axes)
        kwargs.pop('axis', None)
        kwargs.pop('labels', None)
        return super(Panel, self).reindex(**kwargs) 
Example #3
Source File: panel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def reindex(self, *args, **kwargs):
        major = kwargs.pop("major", None)
        minor = kwargs.pop('minor', None)

        if major is not None:
            if kwargs.get("major_axis"):
                raise TypeError("Cannot specify both 'major' and 'major_axis'")
            kwargs['major_axis'] = major
        if minor is not None:
            if kwargs.get("minor_axis"):
                raise TypeError("Cannot specify both 'minor' and 'minor_axis'")

            kwargs['minor_axis'] = minor
        axes = validate_axis_style_args(self, args, kwargs, 'labels',
                                        'reindex')
        kwargs.update(axes)
        kwargs.pop('axis', None)
        kwargs.pop('labels', None)

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", FutureWarning)
            # do not warn about constructing Panel when reindexing
            result = super(Panel, self).reindex(**kwargs)
        return result 
Example #4
Source File: panel.py    From Splunking-Crime with GNU Affero General Public License v3.0 6 votes vote down vote up
def reindex(self, *args, **kwargs):
        major = kwargs.pop("major", None)
        minor = kwargs.pop('minor', None)

        if major is not None:
            if kwargs.get("major_axis"):
                raise TypeError("Cannot specify both 'major' and 'major_axis'")
            kwargs['major_axis'] = major
        if minor is not None:
            if kwargs.get("minor_axis"):
                raise TypeError("Cannot specify both 'minor' and 'minor_axis'")

            kwargs['minor_axis'] = minor
        axes = validate_axis_style_args(self, args, kwargs, 'labels',
                                        'reindex')
        if self.ndim >= 4:
            # Hack for PanelND
            axes = {}
        kwargs.update(axes)
        kwargs.pop('axis', None)
        kwargs.pop('labels', None)
        return super(Panel, self).reindex(**kwargs) 
Example #5
Source File: panel.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def reindex(self, *args, **kwargs):
        major = kwargs.pop("major", None)
        minor = kwargs.pop('minor', None)

        if major is not None:
            if kwargs.get("major_axis"):
                raise TypeError("Cannot specify both 'major' and 'major_axis'")
            kwargs['major_axis'] = major
        if minor is not None:
            if kwargs.get("minor_axis"):
                raise TypeError("Cannot specify both 'minor' and 'minor_axis'")

            kwargs['minor_axis'] = minor
        axes = validate_axis_style_args(self, args, kwargs, 'labels',
                                        'reindex')
        if self.ndim >= 4:
            # Hack for PanelND
            axes = {}
        kwargs.update(axes)
        kwargs.pop('axis', None)
        kwargs.pop('labels', None)
        return super(Panel, self).reindex(**kwargs) 
Example #6
Source File: panel4d.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def panel4d_reindex(self, labs=None, labels=None, items=None, major_axis=None,
                    minor_axis=None, axis=None, **kwargs):
    # Hack for reindex_axis deprecation
    # Ha, we used labels for two different things
    # I think this will work still.
    if labs is None:
        args = ()
    else:
        args = (labs,)
    kwargs_ = dict(labels=labels,
                   items=items,
                   major_axis=major_axis,
                   minor_axis=minor_axis,
                   axis=axis)
    kwargs_ = {k: v for k, v in kwargs_.items() if v is not None}
    # major = kwargs.pop("major", None)
    # minor = kwargs.pop('minor', None)

    # if major is not None:
    #     if kwargs.get("major_axis"):
    #         raise TypeError("Cannot specify both 'major' and 'major_axis'")
    #     kwargs_['major_axis'] = major
    # if minor is not None:
    #     if kwargs.get("minor_axis"):
    #         raise TypeError("Cannot specify both 'minor' and 'minor_axis'")
    #     kwargs_['minor_axis'] = minor

    if axis is not None:
        kwargs_['axis'] = axis

    axes = validate_axis_style_args(self, args, kwargs_, 'labs', 'reindex')
    kwargs.update(axes)
    return NDFrame.reindex(self, **kwargs) 
Example #7
Source File: panel4d.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def panel4d_reindex(self, labs=None, labels=None, items=None, major_axis=None,
                    minor_axis=None, axis=None, **kwargs):
    # Hack for reindex_axis deprecation
    # Ha, we used labels for two different things
    # I think this will work still.
    if labs is None:
        args = ()
    else:
        args = (labs,)
    kwargs_ = dict(labels=labels,
                   items=items,
                   major_axis=major_axis,
                   minor_axis=minor_axis,
                   axis=axis)
    kwargs_ = {k: v for k, v in kwargs_.items() if v is not None}
    # major = kwargs.pop("major", None)
    # minor = kwargs.pop('minor', None)

    # if major is not None:
    #     if kwargs.get("major_axis"):
    #         raise TypeError("Cannot specify both 'major' and 'major_axis'")
    #     kwargs_['major_axis'] = major
    # if minor is not None:
    #     if kwargs.get("minor_axis"):
    #         raise TypeError("Cannot specify both 'minor' and 'minor_axis'")
    #     kwargs_['minor_axis'] = minor

    if axis is not None:
        kwargs_['axis'] = axis

    axes = validate_axis_style_args(self, args, kwargs_, 'labs', 'reindex')
    kwargs.update(axes)
    return NDFrame.reindex(self, **kwargs)