id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
173,380
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
If 'NDFrame.clip' is called via the numpy library, the third parameter in its signature is 'out', which can takes an ndarray, so check if the 'axis' parameter is an instance of ndarray, since 'axis' itself should either be an integer or None
173,381
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
If this function is called via the 'numpy' library, the third parameter in its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so check if the 'skipna' parameter is a boolean or not
173,382
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None
173,383
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
'args' and 'kwargs' should be empty, except for allowed kwargs because all of their necessary parameters are explicitly listed in the function signature
173,384
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
'args' and 'kwargs' should be empty because all of their necessary parameters are explicitly listed in the function signature
173,385
from __future__ import annotations from typing import ( Any, TypeVar, cast, overload, ) from numpy import ndarray from pandas._libs.lib import ( is_bool, is_integer, ) from pandas._typing import ( Axis, AxisInt, ) from pandas.errors import UnsupportedFunctionCall from pandas.util._valida...
Ensure that the axis argument passed to min, max, argmin, or argmax is zero or None, as otherwise it will be incorrectly ignored. Parameters ---------- axis : int or None ndim : int, default 1 Raises ------ ValueError
173,386
from __future__ import annotations import contextlib import copy import io import pickle as pkl from typing import Generator import numpy as np from pandas._libs.arrays import NDArrayBacked from pandas._libs.tslibs import BaseOffset from pandas import Index from pandas.core.arrays import ( DatetimeArray, Period...
null
173,387
from __future__ import annotations import contextlib import copy import io import pickle as pkl from typing import Generator import numpy as np from pandas._libs.arrays import NDArrayBacked from pandas._libs.tslibs import BaseOffset from pandas import Index from pandas.core.arrays import ( DatetimeArray, Period...
null
173,388
from __future__ import annotations import contextlib import copy import io import pickle as pkl from typing import Generator import numpy as np from pandas._libs.arrays import NDArrayBacked from pandas._libs.tslibs import BaseOffset from pandas import Index from pandas.core.arrays import ( DatetimeArray, Period...
null
173,389
from __future__ import annotations import contextlib import copy import io import pickle as pkl from typing import Generator import numpy as np from pandas._libs.arrays import NDArrayBacked from pandas._libs.tslibs import BaseOffset from pandas import Index from pandas.core.arrays import ( DatetimeArray, Period...
Temporarily patch pickle to use our unpickler.
173,390
from __future__ import annotations import bz2 from pickle import PickleBuffer from pandas.compat._constants import PY310 The provided code snippet includes necessary dependencies for implementing the `flatten_buffer` function. Write a Python function `def flatten_buffer( b: bytes | bytearray | memoryview | PickleB...
Return some 1-D `uint8` typed buffer. Coerces anything that does not match that description to one that does without copying if possible (otherwise will copy).
173,391
from __future__ import annotations import io from typing import ( Any, Callable, Sequence, ) from pandas._libs import lib from pandas._typing import ( TYPE_CHECKING, CompressionOptions, ConvertersArg, DtypeArg, DtypeBackend, FilePath, ParseDatesArg, ReadBuffer, StorageOpt...
Extract raw XML data. The method accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. XML string or bytes This method turns (1) into (2) to simplify the rest of the processing. It returns input types (2) and (3) unchanged.
173,392
from __future__ import annotations import io from typing import ( Any, Callable, Sequence, ) from pandas._libs import lib from pandas._typing import ( TYPE_CHECKING, CompressionOptions, ConvertersArg, DtypeArg, DtypeBackend, FilePath, ParseDatesArg, ReadBuffer, StorageOpt...
Convert extracted raw data. This method will return underlying data of extracted XML content. The data either has a `read` attribute (e.g. a file object or a StringIO/BytesIO) or is a string or bytes that is an XML document.
173,393
from __future__ import annotations import io from typing import ( Any, Callable, Sequence, ) from pandas._libs import lib from pandas._typing import ( TYPE_CHECKING, CompressionOptions, ConvertersArg, DtypeArg, DtypeBackend, FilePath, ParseDatesArg, ReadBuffer, StorageOpt...
r""" Read XML document into a ``DataFrame`` object. .. versionadded:: 1.3.0 Parameters ---------- path_or_buffer : str, path object, or file-like object String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a ``read()`` function. The string can be any valid XML string or a path. The ...
173,394
from __future__ import annotations from collections import abc from datetime import ( datetime, timedelta, ) import sys from typing import cast import numpy as np from pandas._typing import ( CompressionOptions, FilePath, ReadBuffer, ) from pandas.errors import ( EmptyDataError, OutOfBoundsD...
Convert to Timestamp if possible, otherwise to datetime.datetime. SAS float64 lacks precision for more than ms resolution so the fit to datetime.datetime is ok. Parameters ---------- sas_datetimes : {Series, Sequence[float]} Dates or datetimes in SAS unit : {str} "d" if the floats represent dates, "s" for datetimes Ret...
173,395
from __future__ import annotations from abc import ( ABCMeta, abstractmethod, ) from types import TracebackType from typing import ( TYPE_CHECKING, Hashable, overload, ) from pandas._typing import ( CompressionOptions, FilePath, ReadBuffer, ) from pandas.util._decorators import doc from ...
null
173,396
from __future__ import annotations from abc import ( ABCMeta, abstractmethod, ) from types import TracebackType from typing import ( TYPE_CHECKING, Hashable, overload, ) from pandas._typing import ( CompressionOptions, FilePath, ReadBuffer, ) from pandas.util._decorators import doc from ...
null
173,397
from __future__ import annotations from abc import ( ABCMeta, abstractmethod, ) from types import TracebackType from typing import ( TYPE_CHECKING, Hashable, overload, ) from pandas._typing import ( CompressionOptions, FilePath, ReadBuffer, ) from pandas.util._decorators import doc from ...
Read SAS files stored as either XPORT or SAS7BDAT format files. Parameters ---------- filepath_or_buffer : str, path object, or file-like object String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a binary ``read()`` function. The string could be a URL. Valid URL schemes include ht...
173,398
from __future__ import annotations from collections import abc from datetime import datetime import struct import warnings import numpy as np from pandas._typing import ( CompressionOptions, DatetimeNaTType, FilePath, ReadBuffer, ) from pandas.util._decorators import Appender from pandas.util._exception...
Given a date in xport format, return Python date.
173,399
from __future__ import annotations from collections import abc from datetime import datetime import struct import warnings import numpy as np from pandas._typing import ( CompressionOptions, DatetimeNaTType, FilePath, ReadBuffer, ) from pandas.util._decorators import Appender from pandas.util._exception...
Parameters ---------- s: str Fixed-length string to split parts: list of (name, length) pairs Used to break up string, name '_' will be filtered from output. Returns ------- Dict of name:contents of string at given location.
173,400
from __future__ import annotations from collections import abc from datetime import datetime import struct import warnings import numpy as np from pandas._typing import ( CompressionOptions, DatetimeNaTType, FilePath, ReadBuffer, ) from pandas.util._decorators import Appender from pandas.util._exception...
null
173,401
from __future__ import annotations from collections import abc from datetime import datetime import struct import warnings import numpy as np from pandas._typing import ( CompressionOptions, DatetimeNaTType, FilePath, ReadBuffer, ) from pandas.util._decorators import Appender from pandas.util._exception...
Parse a vector of float values representing IBM 8 byte floats into native 8 byte floats.
173,402
from __future__ import annotations from collections import abc import numbers import re from typing import ( TYPE_CHECKING, Iterable, Literal, Pattern, Sequence, cast, ) from pandas._libs import lib from pandas._typing import ( BaseBuffer, DtypeBackend, FilePath, ReadBuffer, ) fr...
Replace extra whitespace inside of a string with a single space. Parameters ---------- s : str or unicode The string from which to remove extra whitespace. regex : re.Pattern The regular expression to use to remove extra whitespace. Returns ------- subd : str or unicode `s` with all extra whitespace replaced with a sin...
173,403
from __future__ import annotations from collections import abc import numbers import re from typing import ( TYPE_CHECKING, Iterable, Literal, Pattern, Sequence, cast, ) from pandas._libs import lib from pandas._typing import ( BaseBuffer, DtypeBackend, FilePath, ReadBuffer, ) fr...
Try to read from a url, file or string. Parameters ---------- obj : str, unicode, path object, or file-like object Returns ------- raw_text : str
173,404
from __future__ import annotations from collections import abc import numbers import re from typing import ( TYPE_CHECKING, Iterable, Literal, Pattern, Sequence, cast, ) from pandas._libs import lib from pandas._typing import ( BaseBuffer, DtypeBackend, FilePath, ReadBuffer, ) fr...
Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : unicode An XPath expression that checks for the given HTML attributes.
173,405
from __future__ import annotations from collections import abc import numbers import re from typing import ( TYPE_CHECKING, Iterable, Literal, Pattern, Sequence, cast, ) from pandas._libs import lib from pandas._typing import ( BaseBuffer, DtypeBackend, FilePath, ReadBuffer, ) fr...
r""" Read HTML tables into a ``list`` of ``DataFrame`` objects. Parameters ---------- io : str, path object, or file-like object String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a string ``read()`` function. The string can represent a URL or the HTML itself. Note that lxml only ...
173,406
from __future__ import annotations from pathlib import Path from typing import ( TYPE_CHECKING, Sequence, ) from pandas._libs import lib from pandas.compat._optional import import_optional_dependency from pandas.util._validators import check_dtype_backend from pandas.core.dtypes.inference import is_list_like fr...
Load an SPSS file from the file path, returning a DataFrame. Parameters ---------- path : str or Path File path. usecols : list-like, optional Return a subset of the columns. If None, return all columns. convert_categoricals : bool, default is True Convert categorical columns into pd.Categorical. dtype_backend : {"nump...
173,407
from __future__ import annotations import pickle from typing import Any import warnings from pandas._typing import ( CompressionOptions, FilePath, ReadPickleBuffer, StorageOptions, WriteBuffer, ) from pandas.compat import pickle_compat as pc from pandas.util._decorators import doc from pandas.core.s...
Pickle (serialize) object to file. Parameters ---------- obj : any object Any python object. filepath_or_buffer : str, path object, or file-like object String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a binary ``write()`` function. Also accepts URL. URL has to be of S3 or GCS. {...
173,408
from __future__ import annotations import pickle from typing import Any import warnings from pandas._typing import ( CompressionOptions, FilePath, ReadPickleBuffer, StorageOptions, WriteBuffer, ) from pandas.compat import pickle_compat as pc from pandas.util._decorators import doc from pandas.core.s...
Load pickled pandas object (or any object) from file. .. warning:: Loading pickled data received from untrusted sources can be unsafe. See `here <https://docs.python.org/3/library/pickle.html>`__. Parameters ---------- filepath_or_buffer : str, path object, or file-like object String, path object (implementing ``os.Pat...
173,409
from __future__ import annotations from typing import ( Hashable, Sequence, ) from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer, ) from pandas.compat._optional import import_optional_dependency from pandas.util._decorato...
Write a DataFrame to the binary Feather format. Parameters ---------- df : DataFrame path : str, path object, or file-like object {storage_options} .. versionadded:: 1.2.0 **kwargs : Additional keywords passed to `pyarrow.feather.write_feather`. .. versionadded:: 1.1.0
173,410
from __future__ import annotations from typing import ( Hashable, Sequence, ) from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer, ) from pandas.compat._optional import import_optional_dependency from pandas.util._decorato...
Load a feather-format object from the file path. Parameters ---------- path : str, path object, or file-like object String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a binary ``read()`` function. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For fi...
173,411
from __future__ import annotations from collections import ( abc, defaultdict, ) import csv from io import StringIO import re import sys from typing import ( IO, TYPE_CHECKING, DefaultDict, Hashable, Iterator, List, Literal, Mapping, Sequence, cast, ) import numpy as np f...
null
173,412
from __future__ import annotations from collections import ( abc, defaultdict, ) import csv from io import StringIO import re import sys from typing import ( IO, TYPE_CHECKING, DefaultDict, Hashable, Iterator, List, Literal, Mapping, Sequence, cast, ) import numpy as np f...
Validate the 'skipfooter' parameter. Checks whether 'skipfooter' is a non-negative integer. Raises a ValueError if that is not the case. Parameters ---------- skipfooter : non-negative integer The number of rows to skip at the end of the file. Returns ------- validated_skipfooter : non-negative integer The original inp...
173,413
from __future__ import annotations from collections import defaultdict from copy import copy import csv import datetime from enum import Enum import itertools from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, List, Mapping, Sequence, Tuple, cast, final, ...
null
173,414
from __future__ import annotations from collections import defaultdict from copy import copy import csv import datetime from enum import Enum import itertools from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, List, Mapping, Sequence, Tuple, cast, final, ...
null
173,415
from __future__ import annotations from collections import defaultdict from copy import copy import csv import datetime from enum import Enum import itertools from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, List, Mapping, Sequence, Tuple, cast, final, ...
Get the NaN values for a given column. Parameters ---------- col : str The name of the column. na_values : array-like, dict The object listing the NaN values as strings. na_fvalues : array-like, dict The object listing the NaN values as floats. keep_default_na : bool If `na_values` is a dict, and the column is not mapp...
173,416
from __future__ import annotations from collections import defaultdict from copy import copy import csv import datetime from enum import Enum import itertools from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, List, Mapping, Sequence, Tuple, cast, final, ...
Check whether or not the 'parse_dates' parameter is a non-boolean scalar. Raises a ValueError if that is the case.
173,417
from __future__ import annotations from collections import defaultdict from copy import copy import csv import datetime from enum import Enum import itertools from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, List, Mapping, Sequence, Tuple, cast, final, ...
null
173,418
from __future__ import annotations from collections import defaultdict from typing import ( TYPE_CHECKING, Hashable, Mapping, Sequence, ) import warnings import numpy as np from pandas._libs import ( lib, parsers, ) from pandas._typing import ( ArrayLike, DtypeArg, DtypeObj, Read...
Concatenate chunks of data read with low_memory=True. The tricky part is handling Categoricals, where different chunks may have different inferred categories.
173,419
from __future__ import annotations from collections import defaultdict from typing import ( TYPE_CHECKING, Hashable, Mapping, Sequence, ) import warnings import numpy as np from pandas._libs import ( lib, parsers, ) from pandas._typing import ( ArrayLike, DtypeArg, DtypeObj, Read...
Ensure we have either None, a dtype object, or a dictionary mapping to dtype objects.
173,420
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,421
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,422
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,423
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,424
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,425
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,426
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,427
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,428
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,429
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,430
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
r""" Read a table of fixed-width formatted lines into DataFrame. Also supports optionally iterating or breaking of the file into chunks. Additional help can be found in the `online docs for IO Tools <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html>`_. Parameters ---------- filepath_or_buffer : str, path...
173,431
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
Converts lists of lists/tuples into DataFrames with proper type inference and optional (e.g. string to datetime) conversion. Also enables iterating lazily over chunks of large files Parameters ---------- data : file-like object or list delimiter : separator character to use dialect : str or csv.Dialect instance, option...
173,432
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
null
173,433
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
Extract concrete csv dialect instance. Returns ------- csv.Dialect or None
173,434
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
Merge default kwargs in TextFileReader with dialect parameters. Parameters ---------- dialect : csv.Dialect Concrete csv dialect. See csv.Dialect documentation for more details. defaults : dict Keyword arguments passed to TextFileReader. Returns ------- kwds : dict Updated keyword arguments, merged with dialect paramet...
173,435
from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload, ) import warnings import numpy as np from pandas._libs...
Check whether skipfooter is compatible with other kwargs in TextFileReader. Parameters ---------- kwds : dict Keyword arguments passed to TextFileReader. Raises ------ ValueError If skipfooter is not compatible with other parameters.
173,436
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) from pandas.compat._optional import import_optional_dependency def _try_import(): # since pandas is a dependency of pandas-gbq # we need to import on first use msg = ( "pandas-gbq is required to load data from Goog...
Load data from Google BigQuery. This function requires the `pandas-gbq package <https://pandas-gbq.readthedocs.io>`__. See the `How to authenticate with Google BigQuery <https://pandas-gbq.readthedocs.io/en/latest/howto/authentication.html>`__ guide for authentication instructions. Parameters ---------- query : str SQL...
173,437
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) from pandas.compat._optional import import_optional_dependency def _try_import(): # since pandas is a dependency of pandas-gbq # we need to import on first use msg = ( "pandas-gbq is required to load data from Goog...
null
173,438
from __future__ import annotations from contextlib import contextmanager import copy from functools import partial import operator from typing import ( TYPE_CHECKING, Any, Callable, Generator, Hashable, Sequence, overload, ) import numpy as np from pandas._config import get_option from panda...
Color background in a range according to the data or a gradient map
173,439
from __future__ import annotations from contextlib import contextmanager import copy from functools import partial import operator from typing import ( TYPE_CHECKING, Any, Callable, Generator, Hashable, Sequence, overload, ) import numpy as np from pandas._config import get_option from panda...
Return an array of css props based on condition of data values within given range.
173,440
from __future__ import annotations from contextlib import contextmanager import copy from functools import partial import operator from typing import ( TYPE_CHECKING, Any, Callable, Generator, Hashable, Sequence, overload, ) import numpy as np from pandas._config import get_option from panda...
Return an array of css strings based on the condition of values matching an op.
173,441
from __future__ import annotations from contextlib import contextmanager import copy from functools import partial import operator from typing import ( TYPE_CHECKING, Any, Callable, Generator, Hashable, Sequence, overload, ) import numpy as np from pandas._config import get_option from panda...
Draw bar chart in data cells using HTML CSS linear gradient. Parameters ---------- data : Series or DataFrame Underling subset of Styler data on which operations are performed. align : str in {"left", "right", "mid", "zero", "mean"}, int, float, callable Method for how bars are structured or scalar value of centre poin...
173,442
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Template to return container with information for a <td></td> or <th></th> element.
173,443
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Recursively reduce the number of rows and columns to satisfy max elements. Parameters ---------- rn, cn : int The number of input rows / columns max_elements : int The number of allowable elements max_rows, max_cols : int, optional Directly specify an initial maximum rows or columns before compression. scaling_factor :...
173,444
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Given an index, find the level length for each element. Parameters ---------- index : Index Index or columns to determine lengths of each element sparsify : bool Whether to hide or show each distinct element in a MultiIndex max_index : int The maximum number of elements to analyse along the index due to trimming hidden...
173,445
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Index -> {(idx_row, idx_col): bool}).
173,446
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
looks for multiple CSS selectors and separates them: [{'selector': 'td, th', 'props': 'a:v;'}] ---> [{'selector': 'td', 'props': 'a:v;'}, {'selector': 'th', 'props': 'a:v;'}]
173,447
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Allows formatters to be expressed as str, callable or None, where None returns a default formatting function. wraps with na_rep, and precision where they are available.
173,448
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Ensure that a slice doesn't reduce to a Series or Scalar. Any user-passed `subset` should have this called on it to make sure we're always working with DataFrames.
173,449
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Convert css-string to sequence of tuples format if needed. 'color:red; border:1px solid black;' -> [('color', 'red'), ('border','1px solid red')]
173,450
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Returns a consistent levels arg for use in ``hide_index`` or ``hide_columns``. Parameters ---------- level : int, str, list Original ``level`` arg supplied to above methods. obj: Either ``self.index`` or ``self.columns`` Returns ------- list : refactored arg with a list of levels to hide
173,451
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Indicate whether LaTeX {tabular} should be wrapped with a {table} environment. Parses the `table_styles` and detects any selectors which must be included outside of {tabular}, i.e. indicating that wrapping must occur, and therefore return True, or if a caption exists and requires similar.
173,452
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
Return the first 'props' 'value' from ``tables_styles`` identified by ``selector``. Examples -------- >>> table_styles = [{'selector': 'foo', 'props': [('attr','value')]}, ... {'selector': 'bar', 'props': [('attr', 'overwritten')]}, ... {'selector': 'bar', 'props': [('a1', 'baz'), ('a2', 'ignore')]}] >>> _parse_latex_t...
173,453
from __future__ import annotations from collections import defaultdict from functools import partial import re from typing import ( Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, TypedDict, Union, ) from uuid import uuid4 import numpy as np from pandas._config...
r""" Refactor the cell `display_value` if a 'colspan' or 'rowspan' attribute is present. 'rowspan' and 'colspan' do not occur simultaneouly. If they are detected then the `display_value` is altered to a LaTeX `multirow` or `multicol` command respectively, with the appropriate cell-span. ``wrap`` is used to enclose the ...
173,454
from __future__ import annotations import re from typing import ( Callable, Generator, Iterable, Iterator, ) import warnings from pandas.errors import CSSWarning from pandas.util._exceptions import find_stack_level class Callable(BaseTypingInstance): def py__call__(self, arguments): """ ...
Wrapper to expand shorthand property into top, right, bottom, left properties Parameters ---------- side : str The border side to expand into properties Returns ------- function: Return to call when a 'border(-{side}): {value}' string is encountered
173,455
from __future__ import annotations import re from typing import ( Callable, Generator, Iterable, Iterator, ) import warnings from pandas.errors import CSSWarning from pandas.util._exceptions import find_stack_level class Callable(BaseTypingInstance): def py__call__(self, arguments): """ ...
Wrapper to expand 'border' property into border color, style, and width properties Parameters ---------- side : str The border side to expand into properties Returns ------- function: Return to call when a 'border(-{side}): {value}' string is encountered
173,456
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from typing import ( TYPE_CHECKING, Iterator, Sequence, ) import numpy as np from pandas.core.dtypes.generic import ABCMultiIndex The provided code snippet includes necessary dependencies for implementing the `_split_into_f...
Extract full and short captions from caption string/tuple. Parameters ---------- caption : str or tuple, optional Either table caption string or tuple (full_caption, short_caption). If string is provided, then it is treated as table full caption, while short_caption is considered an empty string. Returns ------- full_c...
173,457
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from typing import ( TYPE_CHECKING, Iterator, Sequence, ) import numpy as np from pandas.core.dtypes.generic import ABCMultiIndex class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]): def __getitem__(se...
Carry out string replacements for special symbols. Parameters ---------- row : list List of string, that may contain special symbols. Returns ------- list list of strings with the special symbols replaced.
173,458
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from typing import ( TYPE_CHECKING, Iterator, Sequence, ) import numpy as np from pandas.core.dtypes.generic import ABCMultiIndex class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]): def __getitem__(se...
Convert elements in ``crow`` to bold.
173,459
from __future__ import annotations import sys from typing import ( Any, Callable, Dict, Iterable, Mapping, Sequence, TypeVar, Union, ) from pandas._config import get_option from pandas.core.dtypes.inference import is_sequence def justify(texts: Iterable[str], max_len: int, mode: str = "r...
Glues together two sets of strings using the amount of space requested. The idea is to prettify. ---------- space : int number of spaces for padding lists : str list of str which being joined strlen : callable function used to calculate the length of each str. Needed for unicode handling. justfunc : callable function u...
173,460
from __future__ import annotations import sys from typing import ( Any, Callable, Dict, Iterable, Mapping, Sequence, TypeVar, Union, ) from pandas._config import get_option from pandas.core.dtypes.inference import is_sequence def pprint_thing( thing: Any, _nest_lvl: int = 0, ...
null
173,461
from __future__ import annotations import sys from typing import ( Any, Callable, Dict, Iterable, Mapping, Sequence, TypeVar, Union, ) from pandas._config import get_option from pandas.core.dtypes.inference import is_sequence def pprint_thing( thing: Any, _nest_lvl: int = 0, ...
null
173,462
from __future__ import annotations import sys from typing import ( Any, Callable, Dict, Iterable, Mapping, Sequence, TypeVar, Union, ) from pandas._config import get_option from pandas.core.dtypes.inference import is_sequence def _pprint_seq( seq: Sequence, _nest_lvl: int = 0, max_se...
Return the formatted obj as a unicode string Parameters ---------- obj : object must be iterable and support __getitem__ formatter : callable string formatter for an element is_justify : bool should justify the display name : name, optional defaults to the class name of the obj indent_for_name : bool, default True Whet...
173,463
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import sys from textwrap import dedent from typing import ( TYPE_CHECKING, Iterable, Iterator, Mapping, Sequence, ) from pandas._config import get_option from pandas._typing import ( Dtype, WriteBuffer, ) fro...
Make string of specified length, padding to the right if necessary. Parameters ---------- s : Union[str, Dtype] String to be formatted. space : int Length to force string to be of. Returns ------- str String coerced to given length. Examples -------- >>> pd.io.formats.info._put_str("panda", 6) 'panda ' >>> pd.io.format...
173,464
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import sys from textwrap import dedent from typing import ( TYPE_CHECKING, Iterable, Iterator, Mapping, Sequence, ) from pandas._config import get_option from pandas._typing import ( Dtype, WriteBuffer, ) fro...
Return size in human readable format. Parameters ---------- num : int Size in bytes. size_qualifier : str Either empty, or '+' (if lower bound). Returns ------- str Size in human readable format. Examples -------- >>> _sizeof_fmt(23028, '') '22.5 KB' >>> _sizeof_fmt(23028, '+') '22.5+ KB'
173,465
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import sys from textwrap import dedent from typing import ( TYPE_CHECKING, Iterable, Iterator, Mapping, Sequence, ) from pandas._config import get_option from pandas._typing import ( Dtype, WriteBuffer, ) fro...
Get memory usage based on inputs and display options.
173,466
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import sys from textwrap import dedent from typing import ( TYPE_CHECKING, Iterable, Iterator, Mapping, Sequence, ) from pandas._config import get_option from pandas._typing import ( Dtype, WriteBuffer, ) fro...
Create mapping between datatypes and their number of occurrences.
173,467
from __future__ import annotations from shutil import get_terminal_size from typing import ( TYPE_CHECKING, Iterable, ) import numpy as np from pandas.io.formats.printing import pprint_thing def _binify(cols: list[int], line_width: int) -> list[int]: adjoin_width = 1 bins = [] curr_width = 0 i_...
null
173,468
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Get the parameters used to repr(dataFrame) calls using DataFrame.to_string. Supplying these parameters to DataFrame.to_string is equivalent to calling ``repr(DataFrame)``. This is useful if you want to adjust the repr output. .. versionadded:: 1.4.0 Example ------- >>> import pandas as pd >>> >>> df = pd.DataFrame([[1,...
173,469
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Get the parameters used to repr(Series) calls using Series.to_string. Supplying these parameters to Series.to_string is equivalent to calling ``repr(series)``. This is useful if you want to adjust the series repr output. .. versionadded:: 1.4.0 Example ------- >>> import pandas as pd >>> >>> ser = pd.Series([1, 2, 3, 4...
173,470
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Perform serialization. Write to buf or return as string if buf is None.
173,471
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Format an array for printing. Parameters ---------- values formatter float_format na_rep digits space justify decimal leading_space : bool, optional, default True Whether the array should be formatted with a leading space. When an array as a column of a Series or DataFrame, we do want the leading space to pad between c...
173,472
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Return a formatter callable taking a datetime64 as input and providing a string as output
173,473
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
given values and a date_format, return a string format
173,474
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Return a formatter function for a range of timedeltas. These will all have the same format argument If box, then show the return in quotes
173,475
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
null
173,476
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Separates the real and imaginary parts from the complex number, and executes the _trim_zeros_float method on each of those.
173,477
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Trims trailing zeros after a decimal point, leaving just one if necessary.
173,478
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
null
173,479
from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) from decimal import Decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_size from typing import ( IO, TYPE_CHECKING, ...
Format float representation in DataFrame with SI notation. Parameters ---------- accuracy : int, default 3 Number of decimal digits after the floating point. use_eng_prefix : bool, default False Whether to represent a value with SI prefixes. Returns ------- None Examples -------- >>> df = pd.DataFrame([1e-9, 1e-3, 1, 1...