id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
172,980 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Generator,
)
from pandas.plotting._core import _get_plot_backend
def _get_plot_backend(backend: str | None = None):
"""
Return the plotting backend to use (e.g. `pandas.plotting._matplotlib`).
... | Bootstrap plot on mean, median and mid-range statistics. The bootstrap plot is used to estimate the uncertainty of a statistic by relying on random sampling with replacement [1]_. This function will generate bootstrapping plots for mean, median and mid-range statistics for the given number of samples of the given size.... |
172,981 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Generator,
)
from pandas.plotting._core import _get_plot_backend
def _get_plot_backend(backend: str | None = None):
"""
Return the plotting backend to use (e.g. `pandas.plotting._matplotlib`).
... | Parallel coordinates plotting. Parameters ---------- frame : DataFrame class_column : str Column name containing class names. cols : list, optional A list of column names to use. ax : matplotlib.axis, optional Matplotlib axis object. color : list or tuple, optional Colors to use for the different classes. use_columns :... |
172,982 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Generator,
)
from pandas.plotting._core import _get_plot_backend
def _get_plot_backend(backend: str | None = None):
"""
Return the plotting backend to use (e.g. `pandas.plotting._matplotlib`).
... | Lag plot for time series. Parameters ---------- series : Series The time series to visualize. lag : int, default 1 Lag length of the scatter plot. ax : Matplotlib axis object, optional The matplotlib axis object to use. **kwds Matplotlib scatter method keyword arguments. Returns ------- matplotlib.axes.Axes Examples --... |
172,983 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Generator,
)
from pandas.plotting._core import _get_plot_backend
def _get_plot_backend(backend: str | None = None):
"""
Return the plotting backend to use (e.g. `pandas.plotting._matplotlib`).
... | Autocorrelation plot for time series. Parameters ---------- series : Series The time series to visualize. ax : Matplotlib axis object, optional The matplotlib axis object to use. **kwargs Options to pass to matplotlib plotting method. Returns ------- matplotlib.axes.Axes Examples -------- The horizontal lines in the pl... |
172,984 | from __future__ import annotations
from abc import (
ABC,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
Hashable,
Iterable,
Literal,
Sequence,
)
import warnings
import matplotlib as mpl
from matplotlib.artist import Artist
import numpy as np
from pandas._typing import (
IndexLabe... | Check if there is a color letter in the style string. |
172,985 | from __future__ import annotations
from math import ceil
from typing import (
TYPE_CHECKING,
Iterable,
Sequence,
)
import warnings
from matplotlib import ticker
import matplotlib.table
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
... | null |
172,986 | from __future__ import annotations
from math import ceil
from typing import (
TYPE_CHECKING,
Iterable,
Sequence,
)
import warnings
from matplotlib import ticker
import matplotlib.table
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
... | null |
172,987 | from __future__ import annotations
from math import ceil
from typing import (
TYPE_CHECKING,
Iterable,
Sequence,
)
import warnings
from matplotlib import ticker
import matplotlib.table
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
... | null |
172,988 | from __future__ import annotations
from math import ceil
from typing import (
TYPE_CHECKING,
Iterable,
Sequence,
)
import warnings
from matplotlib import ticker
import matplotlib.table
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
... | null |
172,989 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,990 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,991 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,992 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,993 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,994 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,995 | from __future__ import annotations
import random
from typing import (
TYPE_CHECKING,
Hashable,
)
from matplotlib import patches
import matplotlib.lines as mlines
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.s... | null |
172,996 | from __future__ import annotations
import numpy as np
from pandas._typing import (
Dict,
IndexLabel,
)
from pandas.core.dtypes.missing import remove_na_arraylike
from pandas import (
DataFrame,
MultiIndex,
Series,
concat,
)
from pandas.plotting._matplotlib.misc import unpack_single_str_list
The... | Create data for iteration given `by` is assigned or not, and it is only used in both hist and boxplot. If `by` is assigned, return a dictionary of DataFrames in which the key of dictionary is the values in groups. If `by` is not assigned, return input as is, and this preserves current status of iter_data. Parameters --... |
172,997 | from __future__ import annotations
import numpy as np
from pandas._typing import (
Dict,
IndexLabel,
)
from pandas.core.dtypes.missing import remove_na_arraylike
from pandas import (
DataFrame,
MultiIndex,
Series,
concat,
)
from pandas.plotting._matplotlib.misc import unpack_single_str_list
Ind... | Internal function to group data, and reassign multiindex column names onto the result in order to let grouped data be used in _compute_plot_data method. Parameters ---------- data : Original DataFrame to plot by : grouped `by` parameter selected by users cols : columns of data set (excluding columns used in `by`) Retur... |
172,998 | from __future__ import annotations
import numpy as np
from pandas._typing import (
Dict,
IndexLabel,
)
from pandas.core.dtypes.missing import remove_na_arraylike
from pandas import (
DataFrame,
MultiIndex,
Series,
concat,
)
from pandas.plotting._matplotlib.misc import unpack_single_str_list
Ind... | Internal function to reformat y given `by` is applied or not for hist plot. If by is None, input y is 1-d with NaN removed; and if by is not None, groupby will take place and input y is multi-dimensional array. |
172,999 | from __future__ import annotations
from datetime import timedelta
import functools
from typing import (
TYPE_CHECKING,
cast,
)
import numpy as np
from pandas._libs.tslibs import (
BaseOffset,
Period,
to_offset,
)
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.core.dtypes.generic import... | null |
173,000 | from __future__ import annotations
from datetime import timedelta
import functools
from typing import (
TYPE_CHECKING,
cast,
)
import numpy as np
from pandas._libs.tslibs import (
BaseOffset,
Period,
to_offset,
)
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.core.dtypes.generic import... | null |
173,001 | from __future__ import annotations
from datetime import timedelta
import functools
from typing import (
TYPE_CHECKING,
cast,
)
import numpy as np
from pandas._libs.tslibs import (
BaseOffset,
Period,
to_offset,
)
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.core.dtypes.generic import... | null |
173,002 | from __future__ import annotations
from datetime import timedelta
import functools
from typing import (
TYPE_CHECKING,
cast,
)
import numpy as np
from pandas._libs.tslibs import (
BaseOffset,
Period,
to_offset,
)
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.core.dtypes.generic import... | Pretty-formats the date axis (x-axis). Major and minor ticks are automatically set for the frequency of the current underlying series. As the dynamic mode is activated by default, changing the limits of the x axis will intelligently change the positions of the ticks. |
173,003 | from __future__ import annotations
import contextlib
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
from typing import (
TYPE_CHECKING,
Any,
Final,
Generator,
cast,
)
from dateutil.relativedelta import relativedelta
import matplotlib.dates ... | Decorator applying pandas_converters. |
173,004 | from __future__ import annotations
import contextlib
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
from typing import (
TYPE_CHECKING,
Any,
Final,
Generator,
cast,
)
from dateutil.relativedelta import relativedelta
import matplotlib.dates ... | null |
173,005 | from __future__ import annotations
import contextlib
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
from typing import (
TYPE_CHECKING,
Any,
Final,
Generator,
cast,
)
from dateutil.relativedelta import relativedelta
import matplotlib.dates ... | null |
173,006 | from __future__ import annotations
import contextlib
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
from typing import (
TYPE_CHECKING,
Any,
Final,
Generator,
cast,
)
from dateutil.relativedelta import relativedelta
import matplotlib.dates ... | null |
173,007 | from __future__ import annotations
import contextlib
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
from typing import (
TYPE_CHECKING,
Any,
Final,
Generator,
cast,
)
from dateutil.relativedelta import relativedelta
import matplotlib.dates ... | null |
173,008 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
)
import numpy as np
from pandas._typing import PlottingOrientation
from pandas.core.dtypes.common import (
is_integer,
is_list_like,
)
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCIndex,
)
from pandas.c... | null |
173,009 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
)
import numpy as np
from pandas._typing import PlottingOrientation
from pandas.core.dtypes.common import (
is_integer,
is_list_like,
)
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCIndex,
)
from pandas.c... | null |
173,010 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Collection,
Literal,
NamedTuple,
)
import warnings
from matplotlib.artist import setp
import numpy as np
from pandas._typing import MatplotlibColor
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common i... | null |
173,011 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Collection,
Literal,
NamedTuple,
)
import warnings
from matplotlib.artist import setp
import numpy as np
from pandas._typing import MatplotlibColor
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common i... | null |
173,012 | from __future__ import annotations
import importlib
import types
from typing import (
TYPE_CHECKING,
Sequence,
)
from pandas._config import get_option
from pandas._typing import IndexLabel
from pandas.util._decorators import (
Appender,
Substitution,
)
from pandas.core.dtypes.common import (
is_inte... | Draw histogram of the input series using matplotlib. Parameters ---------- by : object, optional If passed, then used to form histograms for separate groups. ax : matplotlib axis object If not passed, uses gca(). grid : bool, default True Whether to show axis grid lines. xlabelsize : int, default None If specified chan... |
173,013 | from __future__ import annotations
import importlib
import types
from typing import (
TYPE_CHECKING,
Sequence,
)
from pandas._config import get_option
from pandas._typing import IndexLabel
from pandas.util._decorators import (
Appender,
Substitution,
)
from pandas.core.dtypes.common import (
is_inte... | Make a histogram of the DataFrame's columns. A `histogram`_ is a representation of the distribution of data. This function calls :meth:`matplotlib.pyplot.hist`, on each series in the DataFrame, resulting in one histogram per column. .. _histogram: https://en.wikipedia.org/wiki/Histogram Parameters ---------- data : Dat... |
173,014 | from __future__ import annotations
import importlib
import types
from typing import (
TYPE_CHECKING,
Sequence,
)
from pandas._config import get_option
from pandas._typing import IndexLabel
from pandas.util._decorators import (
Appender,
Substitution,
)
from pandas.core.dtypes.common import (
is_inte... | null |
173,015 | from __future__ import annotations
import importlib
import types
from typing import (
TYPE_CHECKING,
Sequence,
)
from pandas._config import get_option
from pandas._typing import IndexLabel
from pandas.util._decorators import (
Appender,
Substitution,
)
from pandas.core.dtypes.common import (
is_inte... | null |
173,016 | from __future__ import annotations
import importlib
import types
from typing import (
TYPE_CHECKING,
Sequence,
)
from pandas._config import get_option
from pandas._typing import IndexLabel
from pandas.util._decorators import (
Appender,
Substitution,
)
from pandas.core.dtypes.common import (
is_inte... | Make box plots from DataFrameGroupBy data. Parameters ---------- grouped : Grouped DataFrame subplots : bool * ``False`` - no subplots will be used * ``True`` - create a subplot for each group. column : column name or list of names, or vector Can be any valid input to groupby. fontsize : float or str rot : label rotati... |
173,017 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Given an indexer for the first dimension, create an equivalent tuple for indexing over all dimensions. Parameters ---------- ndim : int loc : object Returns ------- tuple |
173,018 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | If we have an axis, adapt the given key to be axis-independent. |
173,019 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Check if key is a valid boolean indexer for an object with such index and perform reindexing or conversion if needed. This function assumes that is_bool_indexer(key) == True. Parameters ---------- index : Index Index of the object on which the indexing is done. key : list-like Boolean indexer to check. Returns ------- ... |
173,020 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Reverse convert a missing indexer, which is a dict return the scalar indexer and a boolean indicating if we converted |
173,021 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Create a filtered indexer that doesn't have any missing indexers. |
173,022 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | We likely want to take the cross-product. |
173,023 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Returns ------- bool |
173,024 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Returns ------- bool |
173,025 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Returns ------- bool |
173,026 | from __future__ import annotations
from contextlib import suppress
import sys
from typing import (
TYPE_CHECKING,
Hashable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas._libs.indexing import NDFrameIndexerBase
fro... | Check if the indexer is or contains a dict or set, which is no longer allowed. |
173,027 | from __future__ import annotations
import collections
from collections import abc
import datetime
import functools
from io import StringIO
import itertools
import sys
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Any,
Callable,
Hashable,
Iterable,
Iterator,
Literal,
Map... | null |
173,028 | from __future__ import annotations
import collections
from collections import abc
import datetime
import functools
from io import StringIO
import itertools
import sys
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Any,
Callable,
Hashable,
Iterable,
Iterator,
Literal,
Map... | null |
173,029 | from __future__ import annotations
import sys
from textwrap import dedent
from typing import (
IO,
TYPE_CHECKING,
Any,
Callable,
Hashable,
Iterable,
Literal,
Mapping,
Sequence,
Union,
cast,
overload,
)
import warnings
import weakref
import numpy as np
from pandas._config ... | Install the scalar coercion methods. |
173,030 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Hashable,
Iterable,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
algos,
hashtable,
lib,
)
from pandas._libs.hashtable import unique... | Helper method that return the indexer according to input parameters for the sort_index method of DataFrame and Series. Parameters ---------- target : Index level : int or level name or list of ints or list of level names ascending : bool or list of bools, default True kind : {'quicksort', 'mergesort', 'heapsort', 'stab... |
173,031 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Hashable,
Iterable,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
algos,
hashtable,
lib,
)
from pandas._libs.hashtable import unique... | Group_index is offsets into cartesian product of all possible labels. This space can be huge, so this function compresses it, by computing offsets (comp_ids) into the list of unique labels (obs_group_ids). Parameters ---------- labels : list of label arrays sizes : tuple[int] of size of the levels Returns ------- np.nd... |
173,032 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Hashable,
Iterable,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
algos,
hashtable,
lib,
)
from pandas._libs.hashtable import unique... | Implementation of np.argmin/argmax but for ExtensionArray and which handles missing values. Parameters ---------- values : ExtensionArray method : {"argmax", "argmin"} axis : int, default 0 Returns ------- int |
173,033 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Hashable,
Iterable,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
algos,
hashtable,
lib,
)
from pandas._libs.hashtable import unique... | Map compressed group id -> key tuple. |
173,034 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Hashable,
Iterable,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
algos,
hashtable,
lib,
)
from pandas._libs.hashtable import unique... | Returns ------- dict: Labels mapped to indexers. |
173,035 | from __future__ import annotations
import operator
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
cast,
)
import warnings
import numpy as np
from pandas._libs import (
algos,
hashtable as htable,
iNaT,
lib,
)
from pandas._typing import (
AnyArrayLike,
ArrayL... | Return the number of unique values for integer array-likes. Significantly faster than pandas.unique for long enough sequences. No checks are done to ensure input is integral. Parameters ---------- values : 1d array-like Returns ------- int : The number of unique values in ``values`` |
173,036 | from __future__ import annotations
import operator
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
cast,
)
import warnings
import numpy as np
from pandas._libs import (
algos,
hashtable as htable,
iNaT,
lib,
)
from pandas._typing import (
AnyArrayLike,
ArrayL... | Rank the values along a given axis. Parameters ---------- values : np.ndarray or ExtensionArray Array whose values will be ranked. The number of dimensions in this array must not exceed 2. axis : int, default 0 Axis over which to perform rankings. method : {'average', 'min', 'max', 'first', 'dense'}, default 'average' ... |
173,037 | from __future__ import annotations
import operator
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
cast,
)
import warnings
import numpy as np
from pandas._libs import (
algos,
hashtable as htable,
iNaT,
lib,
)
from pandas._typing import (
AnyArrayLike,
ArrayL... | Perform array addition that checks for underflow and overflow. Performs the addition of an int64 array and an int64 integer (or array) but checks that they do not result in overflow first. For elements that are indicated to be NaN, whether or not there is overflow for that element is automatically ignored. Parameters -... |
173,038 | from __future__ import annotations
import operator
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
cast,
)
import warnings
import numpy as np
from pandas._libs import (
algos,
hashtable as htable,
iNaT,
lib,
)
from pandas._typing import (
AnyArrayLike,
ArrayL... | Extracts the union from lvals and rvals with respect to duplicates and nans in both arrays. Parameters ---------- lvals: np.ndarray or ExtensionArray left values which is ordered in front. rvals: np.ndarray or ExtensionArray right values ordered after lvals. Returns ------- np.ndarray or ExtensionArray Containing the u... |
173,039 | from __future__ import annotations
import collections
import datetime as dt
from functools import partial
import gc
from json import loads
import operator
import pickle
import re
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Hashable,
Iterator,
Literal,
Mapping,
NoRetu... | Return a tuple of the doc params. |
173,040 | from __future__ import annotations
import collections
import datetime as dt
from functools import partial
import gc
from json import loads
import operator
import pickle
import re
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Hashable,
Iterator,
Literal,
Mapping,
NoRetu... | If we are aligning timezone-aware DatetimeIndexes and the timezones do not match, convert both to UTC. |
173,041 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | return a boolean if we have a nested object, e.g. a Series with 1 or more Series elements This may not be necessarily be performant. |
173,042 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | If array is a int/uint/float bit size lower than 64 bit, upcast it to 64 bit. Parameters ---------- arr : ndarray or ExtensionArray Returns ------- ndarray or ExtensionArray |
173,043 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | Try casting result of a pointwise operation back to the original dtype if appropriate. Parameters ---------- result : array-like Result to cast. dtype : np.dtype or ExtensionDtype Input Series from which result was calculated. numeric_only : bool, default False Whether to cast only numerics or datetimes as well. same_d... |
173,044 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | Change string like dtypes to object for ``DataFrame.select_dtypes()``. |
173,045 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | Convert objects to best possible type, and optionally, to types supporting ``pd.NA``. Parameters ---------- input_array : ExtensionArray or np.ndarray convert_string : bool, default True Whether object dtypes should be converted to ``StringDtype()``. convert_integer : bool, default True Whether, if possible, conversion... |
173,046 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | Find the type/dtype for a the result of an operation between these objects. This is similar to find_common_type, but looks at the objects instead of just their dtypes. This can be useful in particular when one of the objects does not have a `dtype`. Parameters ---------- left : np.ndarray or ExtensionArray right : Any ... |
173,047 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | null |
173,048 | from __future__ import annotations
import datetime as dt
import functools
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.missing import (
NA,
NAType,
checknull,
... | Can we do an inplace setitem with this element in an array with this dtype? Parameters ---------- arr : np.ndarray or ExtensionArray element : Any Returns ------- bool |
173,049 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Type,
cast,
)
def create_pandas_abc_type(name, attr, comp):
def _check(inst) -> bool:
return getattr(inst, attr, "_typ") in comp
# https://github.com/python/mypy/issues/1006
# error: 'classmethod' used with a non-me... | null |
173,050 | from __future__ import annotations
import inspect
from typing import (
TYPE_CHECKING,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs.timedeltas import array_to_timedelta64
from pandas._typing import (
ArrayLike,
DtypeObj,
IgnoreRaise,
)
from pand... | Cast array (ndarray or ExtensionArray) to the new dtype. This basically is the implementation for DataFrame/Series.astype and includes all custom logic for pandas (NaN-safety, converting str to object, not allowing ) Parameters ---------- values : ndarray or ExtensionArray dtype : str, dtype convertible copy : bool, de... |
173,051 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
class Number(metaclass=ABCMeta):
def __hash__(self) -> int: ...
The provided code snippet includes necessary dependencies for implementing ... | Check if the object is a number. Returns True when the object is a number, and False if is not. Parameters ---------- obj : any type The object to check if is a number. Returns ------- bool Whether `obj` is a number or not. See Also -------- api.types.is_integer: Checks a subgroup of numbers. Examples -------- >>> from... |
173,052 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
The provided code snippet includes necessary dependencies for implementing the `is_file_like` function. Write a Python function `def is_file_lik... | Check if the object is a file-like object. For objects to be considered file-like, they must be an iterator AND have either a `read` and/or `write` method as an attribute. Note: file-like objects must be iterable, but iterable objects need not be file-like. Parameters ---------- obj : The object to check Returns ------... |
173,053 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
class Pattern(Generic[AnyStr]):
flags: int
groupindex: Mapping[str, int]
groups: int
pattern: AnyStr
def search(self, string... | Check if the object is a regex pattern instance. Parameters ---------- obj : The object to check Returns ------- bool Whether `obj` is a regex pattern. Examples -------- >>> from pandas.api.types import is_re >>> import re >>> is_re(re.compile(".*")) True >>> is_re("foo") False |
173,054 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
The provided code snippet includes necessary dependencies for implementing the `is_re_compilable` function. Write a Python function `def is_re_c... | Check if the object can be compiled into a regex pattern instance. Parameters ---------- obj : The object to check Returns ------- bool Whether `obj` can be compiled as a regex pattern. Examples -------- >>> from pandas.api.types import is_re_compilable >>> is_re_compilable(".*") True >>> is_re_compilable(1) False |
173,055 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
is_list_like = lib.is_list_like
The provided code snippet includes necessary dependencies for implementing the `is_nested_list_like` function. W... | Check if the object is list-like, and that all of its elements are also list-like. Parameters ---------- obj : The object to check Returns ------- is_list_like : bool Whether `obj` has list-like properties. Examples -------- >>> is_nested_list_like([[1, 2, 3]]) True >>> is_nested_list_like([{1, 2, 3}, {1, 2, 3}]) True ... |
173,056 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
The provided code snippet includes necessary dependencies for implementing the `is_dict_like` function. Write a Python function `def is_dict_lik... | Check if the object is dict-like. Parameters ---------- obj : The object to check Returns ------- bool Whether `obj` has dict-like properties. Examples -------- >>> from pandas.api.types import is_dict_like >>> is_dict_like({1: 2}) True >>> is_dict_like([1, 2, 3]) False >>> is_dict_like(dict) False >>> is_dict_like(dic... |
173,057 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
The provided code snippet includes necessary dependencies for implementing the `is_named_tuple` function. Write a Python function `def is_named_... | Check if the object is a named tuple. Parameters ---------- obj : The object to check Returns ------- bool Whether `obj` is a named tuple. Examples -------- >>> from collections import namedtuple >>> from pandas.api.types import is_named_tuple >>> Point = namedtuple("Point", ["x", "y"]) >>> p = Point(1, 2) >>> >>> is_n... |
173,058 | from __future__ import annotations
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
The provided code snippet includes necessary dependencies for implementing the `is_dataclass` function. Write a Python function `def is_dataclas... | Checks if the object is a data-class instance Parameters ---------- item : object Returns -------- is_dataclass : bool True if the item is an instance of a data-class, will return false if you pass the data class itself Examples -------- >>> from dataclasses import dataclass >>> @dataclass ... class Point: ... x: int .... |
173,059 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Ensure that an array object has a float dtype if possible. Parameters ---------- arr : array-like The array whose data type we want to enforce as float. Returns ------- float_arr : The original array cast to the float dtype if possible. Otherwise, the original array is returned. |
173,060 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Ensure that a value is a python int. Parameters ---------- value: int or numpy.integer Returns ------- int Raises ------ TypeError: if the value isn't an int or can't be converted to one. |
173,061 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes ----- If scipy is not installed, this function will always return False. Examples -------- >>>... |
173,062 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Check whether the provided array or dtype is of the int64 dtype. Parameters ---------- arr_or_dtype : array-like or dtype The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the int64 dtype. Notes ----- Depending on system architecture, the return value of `is_int64_dtype( int)`... |
173,063 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Check whether the provided array or dtype is of a real number dtype. Parameters ---------- arr_or_dtype : array-like or dtype The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of a real number dtype. Examples -------- >>> from pandas.api.types import is_any_real_numeric_dtype >>>... |
173,064 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Check for ExtensionDtype, datetime64 dtype, or timedelta64 dtype. Notes ----- Checks only for dtype objects, not dtype-castable strings or types. |
173,065 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Get a numpy dtype.type-style object for a dtype object. This methods also includes handling of the datetime64[ns] and datetime64[ns, TZ] objects. If no dtype can be found, we return ``object``. Parameters ---------- dtype : dtype, type The dtype object whose numpy dtype.type-style object we want to extract. Returns ---... |
173,066 | from __future__ import annotations
from typing import (
Any,
Callable,
)
import warnings
import numpy as np
from pandas._libs import (
Interval,
Period,
algos,
lib,
)
from pandas._libs.tslibs import conversion
from pandas._typing import (
ArrayLike,
DtypeObj,
)
from pandas.core.dtypes.ba... | Return None if all args are hashable, else raise a TypeError. Parameters ---------- *args Arguments to validate. error_name : str, optional The name to use if error Raises ------ TypeError : If an argument is not hashable Returns ------- None |
173,067 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
TypeVar,
cast,
overload,
)
import numpy as np
from pandas._libs import missing as libmissing
from pandas._libs.hashtable import object_hash
from pandas._typing import (
DtypeObj,
Shape,
npt,
type_t,
)
from pa... | Register an ExtensionType with pandas as class decorator. This enables operations like ``.astype(name)`` for the name of the ExtensionDtype. Returns ------- callable A class decorator. Examples -------- >>> from pandas.api.extensions import register_extension_dtype, ExtensionDtype >>> @register_extension_dtype ... clas... |
173,068 | from __future__ import annotations
from decimal import Decimal
from functools import partial
from typing import (
TYPE_CHECKING,
overload,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import (
NaT,
... | Parameters ---------- arr: a numpy array fill_value: fill value, default to np.nan Returns ------- True if we can fill using this fill_value |
173,069 | from __future__ import annotations
from decimal import Decimal
from functools import partial
from typing import (
TYPE_CHECKING,
overload,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import (
NaT,
... | ExtensionArray-compatible implementation of array_equivalent. |
173,070 | from __future__ import annotations
from decimal import Decimal
from functools import partial
from typing import (
TYPE_CHECKING,
overload,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import (
NaT,
... | infer the fill value for the nan/NaT from the provided scalar/ndarray/list-like if we are a NaT, return the correct dtyped element to provide proper block construction |
173,071 | from __future__ import annotations
from decimal import Decimal
from functools import partial
from typing import (
TYPE_CHECKING,
overload,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import (
NaT,
... | Fill numpy.ndarray with NaN, unless we have a integer or boolean dtype. |
173,072 | from __future__ import annotations
from decimal import Decimal
from functools import partial
from typing import (
TYPE_CHECKING,
overload,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import (
NaT,
... | Optimized equivalent to isna(arr).all() |
173,073 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs import lib
from pandas._typing import AxisInt
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCSeries,
)
AxisInt = int
ABCSeries = cast(
"Type[Series]",
create_pandas_abc_type("ABCSeries",... | Process and validate the `weights` argument to `NDFrame.sample` and `.GroupBy.sample`. Returns `weights` as an ndarray[np.float64], validated except for normalizing weights (because that must be done groupwise in groupby sampling). |
173,074 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs import lib
from pandas._typing import AxisInt
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCSeries,
)
The provided code snippet includes necessary dependencies for implementing the `process_samp... | Process and validate the `n` and `frac` arguments to `NDFrame.sample` and `.GroupBy.sample`. Returns None if `frac` should be used (variable sampling sizes), otherwise returns the constant sampling size. |
173,075 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs import lib
from pandas._typing import AxisInt
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCSeries,
)
The provided code snippet includes necessary dependencies for implementing the `sample` func... | Randomly sample `size` indices in `np.arange(obj_len)` Parameters ---------- obj_len : int The length of the indices being considered size : int The number of values to choose replace : bool Allow or disallow sampling of the same row more than once. weights : np.ndarray[np.float64] or None If None, equal probability we... |
173,076 | from __future__ import annotations
import numpy as np
from pandas._libs.internals import BlockPlacement
from pandas._typing import Dtype
from pandas.core.dtypes.common import (
is_datetime64tz_dtype,
is_period_dtype,
pandas_dtype,
)
from pandas.core.arrays import DatetimeArray
from pandas.core.construction ... | This is a pseudo-public analogue to blocks.new_block. We ask that downstream libraries use this rather than any fully-internal APIs, including but not limited to: - core.internals.blocks.make_block - Block.make_block - Block.make_block_same_class - Block.__init__ |
173,077 | from __future__ import annotations
import copy as cp
import itertools
from typing import (
TYPE_CHECKING,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
NaT,
internals as libinternals,
)
from pandas._libs.missing import NA
from pandas._typing import (
ArrayLike,
AxisInt,
... | Concatenate block managers into one. Parameters ---------- mgrs_indexers : list of (BlockManager, {axis: indexer,...}) tuples axes : list of Index concat_axis : int copy : bool Returns ------- BlockManager |
173,078 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Iterator,
NamedTuple,
)
from pandas._typing import ArrayLike
def _iter_block_pairs(
left: BlockManager, right: BlockManager
) -> Iterator[BlockPairInfo]:
# At this point we have already checked the parent DataFrames for
# as... | null |
173,079 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Iterator,
NamedTuple,
)
from pandas._typing import ArrayLike
def _iter_block_pairs(
left: BlockManager, right: BlockManager
) -> Iterator[BlockPairInfo]:
# At this point we have already checked the parent DataFrames for
# as... | Blockwise `all` reduction. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.