Esempio n. 1
0
File: core.py Progetto: rongou/cudf
    def sort_values(
        self,
        by,
        ignore_index=False,
        max_branch=None,
        divisions=None,
        set_divisions=False,
        ascending=True,
        na_position="last",
        sort_function=None,
        sort_function_kwargs=None,
        **kwargs,
    ):
        if kwargs:
            raise ValueError(
                f"Unsupported input arguments passed : {list(kwargs.keys())}")

        df = sorting.sort_values(
            self,
            by,
            max_branch=max_branch,
            divisions=divisions,
            set_divisions=set_divisions,
            ignore_index=ignore_index,
            ascending=ascending,
            na_position=na_position,
            sort_function=sort_function,
            sort_function_kwargs=sort_function_kwargs,
        )

        if ignore_index:
            return df.reset_index(drop=True)
        return df
Esempio n. 2
0
    def sort_values(
        self,
        by,
        ignore_index=False,
        max_branch=None,
        divisions=None,
        set_divisions=False,
        **kwargs,
    ):
        if kwargs:
            raise ValueError(
                f"Unsupported input arguments passed : {list(kwargs.keys())}")

        if self.npartitions == 1:
            df = self.map_partitions(M.sort_values, by)
        else:
            df = sorting.sort_values(
                self,
                by,
                max_branch=max_branch,
                divisions=divisions,
                set_divisions=set_divisions,
                ignore_index=ignore_index,
            )

        if ignore_index:
            return df.reset_index(drop=True)
        return df
Esempio n. 3
0
    def sort_values(
        self,
        by,
        ignore_index=False,
        max_branch=None,
        divisions=None,
        set_divisions=False,
        **kwargs,
    ):
        if self.npartitions == 1:
            df = self.map_partitions(M.sort_values, by)
        else:
            df = sorting.sort_values(
                self,
                by,
                max_branch=max_branch,
                divisions=divisions,
                set_divisions=set_divisions,
                ignore_index=ignore_index,
            )

        if ignore_index:
            return df.reset_index(drop=True)
        return df