id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
173,480
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, ...
For each index in each level the function returns lengths of indexes. Parameters ---------- levels : list of lists List of values on for level. sentinel : string, optional Value which states that no new index starts on there. Returns ------- Returns list of maps. For each level returns map of indexes (key is index in r...
173,481
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, ...
Appends lines to a buffer. Parameters ---------- buf The buffer to write to lines The lines to append.
173,482
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Wrap result set of query in a DataFrame.
173,483
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Execute the given SQL query using the provided connection object. Parameters ---------- sql : string SQL query to be executed. con : SQLAlchemy connection or sqlite3 connection If a DBAPI2 object, only sqlite3 is supported. params : list or tuple, optional, default: None List of parameters to pass to execute method. Re...
173,484
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,485
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,486
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Read SQL database table into a DataFrame. Given a table name and a SQLAlchemy connectable, returns a DataFrame. This function does not support DBAPI connections. Parameters ---------- table_name : str Name of SQL table in database. con : SQLAlchemy connectable or str A database URI could be provided as str. SQLite DBAP...
173,487
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,488
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,489
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Read SQL query into a DataFrame. Returns a DataFrame corresponding to the result set of the query string. Optionally provide an `index_col` parameter to use one of the columns as the index, otherwise default integer index will be used. Parameters ---------- sql : str SQL query or SQLAlchemy Selectable (select or text o...
173,490
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,491
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,492
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Read SQL query or database table into a DataFrame. This function is a convenience wrapper around ``read_sql_table`` and ``read_sql_query`` (for backward compatibility). It will delegate to the specific function depending on the provided input. A SQL query will be routed to ``read_sql_query``, while a database table nam...
173,493
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame, Series name : str Name of SQL table. con : SQLAlchemy connectable(engine/connection) or database string URI or sqlite3 DBAPI2 connection Using SQLAlchemy makes it possible to use any DB supported by that library. If a DBAPI2...
173,494
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
return our implementation
173,495
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
null
173,496
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from contextlib import ( ExitStack, contextmanager, ) from datetime import ( date, datetime, time, ) from functools import partial import re from typing import ( TYPE_CHECKING, Any, Iterator, Literal,...
Get the SQL db table schema for the given frame. Parameters ---------- frame : DataFrame name : str name of SQL table keys : string or sequence, default: None columns to use a primary key con: an open SQL database connection object or a SQLAlchemy connectable Using SQLAlchemy makes it possible to use any DB supported b...
173,497
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, cast, ) import warnings from pandas._libs.json import loads from pandas._libs.tslibs import timezones from pandas._typing import ( DtypeObj, JSONSerializable, ) from pandas.util._exceptions import find_stack_level from panda...
Create a Table schema from ``data``. Parameters ---------- data : Series, DataFrame index : bool, default True Whether to include ``data.index`` in the schema. primary_key : bool or None, default True Column names to designate as the primary key. The default `None` will set `'primaryKey'` to the index level or levels i...
173,498
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, cast, ) import warnings from pandas._libs.json import loads from pandas._libs.tslibs import timezones from pandas._typing import ( DtypeObj, JSONSerializable, ) from pandas.util._exceptions import find_stack_level from panda...
Builds a DataFrame from a given schema Parameters ---------- json : A JSON table schema precise_float : bool Flag controlling precision when decoding string to double values, as dictated by ``read_json`` Returns ------- df : DataFrame Raises ------ NotImplementedError If the JSON table schema contains either timezone o...
173,499
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,500
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,501
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,502
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,503
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,504
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,505
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
null
173,506
from __future__ import annotations from abc import ( ABC, abstractmethod, ) from collections import abc from io import StringIO from itertools import islice from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Generic, Literal, Mapping, TypeVar, over...
Convert a JSON string to pandas object. Parameters ---------- path_or_buf : a valid JSON str, path object or file-like object Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: ``file://localhost/pa...
173,507
from __future__ import annotations from collections import ( abc, defaultdict, ) import copy import sys from typing import ( Any, DefaultDict, Iterable, ) import numpy as np from pandas._libs.writers import convert_json_to_lines from pandas._typing import ( IgnoreRaise, Scalar, ) import pand...
Normalize semi-structured JSON data into a flat table. Parameters ---------- data : dict or list of dicts Unserialized JSON objects. record_path : str or list of str, default None Path in each object to list of records. If not passed, data will be assumed to be an array of records. meta : list of paths (str or list of ...
173,508
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,509
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
Ensure that an index / column name is a str (python 3); otherwise they may be np.string dtype. Non-string dtypes are passed through unchanged. https://github.com/pandas-dev/pandas/issues/13492
173,510
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
store this object, close it if we opened it
173,511
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
Read from the store, close it if we opened it. Retrieve pandas object stored in file, optionally based on where criteria. .. warning:: Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the "fixed" format. Loading pickled data received from untrust...
173,512
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,513
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
for a tz-aware type, return an encoded zone
173,514
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,515
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,516
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
coerce the values to a DatetimeIndex if tz is set preserve the input shape if possible Parameters ---------- values : ndarray or Index tz : str or tzinfo coerce : if we do not have a passed timezone, coerce to M8[ns] ndarray
173,517
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,518
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,519
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,520
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
null
173,521
from __future__ import annotations from contextlib import suppress import copy from datetime import ( date, tzinfo, ) import itertools import os import re from textwrap import dedent from types import TracebackType from typing import ( TYPE_CHECKING, Any, Callable, Final, Hashable, Itera...
Prior to 0.10.1, we named values blocks like: values_block_0 an the name values_0, adjust the given name if necessary. Parameters ---------- name : str version : Tuple[int, int, int] Returns ------- str
173,522
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import codecs from collections import defaultdict import dataclasses import functools import gzip from io import ( BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOBase, TextIOWrapper, ) import mmap import os ...
converts an absolute native path to a FILE URL. Parameters ---------- path : a path in native format Returns ------- a valid FILE URL
173,523
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import codecs from collections import defaultdict import dataclasses import functools import gzip from io import ( BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOBase, TextIOWrapper, ) import mmap import os ...
Check whether or not the `columns` parameter could be converted into a MultiIndex. Parameters ---------- columns : array-like Object which may or may not be convertible into a MultiIndex index_col : None, bool or list, optional Column or columns to use as the (possibly hierarchical) index Returns ------- bool : Whether...
173,524
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import codecs from collections import defaultdict import dataclasses import functools import gzip from io import ( BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOBase, TextIOWrapper, ) import mmap import os ...
Rename column names if duplicates exist. Currently the renaming is done by appending a period and an autonumeric, but a custom pattern may be supported in the future. Examples -------- >>> dedup_names(["x", "y", "x", "x"], is_potential_multiindex=False) ['x', 'y', 'x.1', 'x.2']
173,525
from __future__ import annotations import io import os from typing import ( Any, Literal, ) import warnings from warnings import catch_warnings from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer, ) from pandas.compat._opt...
File handling for PyArrow.
173,526
from __future__ import annotations import io import os from typing import ( Any, Literal, ) import warnings from warnings import catch_warnings from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer, ) from pandas.compat._opt...
Write a DataFrame to the parquet format. Parameters ---------- df : DataFrame path : str, path object, file-like object, or None, default None String, path object (implementing ``os.PathLike[str]``), or file-like object implementing a binary ``write()`` function. If None, the result is returned as bytes. If a string, i...
173,527
from __future__ import annotations import io import os from typing import ( Any, Literal, ) import warnings from warnings import catch_warnings from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer, ) from pandas.compat._opt...
Load a parquet object from the file path, returning a DataFrame. 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, g...
173,528
from __future__ import annotations from io import StringIO from typing import TYPE_CHECKING import warnings from pandas._libs import lib from pandas.util._exceptions import find_stack_level from pandas.util._validators import check_dtype_backend from pandas.core.dtypes.generic import ABCDataFrame from pandas import ( ...
r""" Read text from clipboard and pass to read_csv. Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespace characters. dtype_backend : {"numpy_nullable", "pyarrow"}, defaults to NumPy backed DataFrames Which dtype_backend to use, e.g. whether a Da...
173,529
from __future__ import annotations from io import StringIO from typing import TYPE_CHECKING import warnings from pandas._libs import lib from pandas.util._exceptions import find_stack_level from pandas.util._validators import check_dtype_backend from pandas.core.dtypes.generic import ABCDataFrame from pandas import ( ...
Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : bool, defaults to True if True, use the provided separator, writing in a csv format for allowing easy pasting into exce...
173,530
from __future__ import annotations import io from types import ModuleType from typing import ( Any, Literal, ) from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, WriteBuffer, ) from pandas.compat._optional import import_optional_dependency from pandas.u...
Load an ORC object from the file path, returning a DataFrame. 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...
173,531
from __future__ import annotations import io from types import ModuleType from typing import ( Any, Literal, ) from pandas._libs import lib from pandas._typing import ( DtypeBackend, FilePath, ReadBuffer, WriteBuffer, ) from pandas.compat._optional import import_optional_dependency from pandas.u...
Write a DataFrame to the ORC format. .. versionadded:: 1.5.0 Parameters ---------- df : DataFrame The dataframe to be written to ORC. Raises NotImplementedError if dtype of one or more columns is category, unsigned integers, intervals, periods or sparse. path : str, file-like object or None, default None If a string, i...
173,532
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Convert from SIF to datetime. https://www.stata.com/help.cgi?datetime Parameters ---------- dates : Series The Stata Internal Format date to convert to datetime according to fmt fmt : str The format to convert to. Can be, tc, td, tw, tm, tq, th, ty Returns Returns ------- converted : Series The converted dates Examples...
173,533
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Convert from datetime to SIF. https://www.stata.com/help.cgi?datetime Parameters ---------- dates : Series Series or array containing datetime.datetime or datetime64[ns] to convert to the Stata Internal Format given by fmt fmt : str The format to convert to. Can be, tc, td, tw, tm, tq, th, ty
173,534
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Checks the dtypes of the columns of a pandas DataFrame for compatibility with the data types and ranges supported by Stata, and converts if necessary. Parameters ---------- data : DataFrame The DataFrame to check and convert Notes ----- Numeric columns in Stata must be one of int8, int16, int32, float32 or float64, wit...
173,535
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
null
173,536
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
null
173,537
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Take a char string and pads it with null bytes until it's length chars.
173,538
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Convert from one of the stata date formats to a type in TYPE_MAP.
173,539
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
null
173,540
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Convert dtype types to stata types. Returns the byte of the given ordinal. See TYPE_MAP and comments for an explanation. This is also explained in the dta spec. 1 - 244 are strings of this length Pandas Stata 251 - for int8 byte 252 - for int16 int 253 - for int32 long 254 - for float32 float 255 - for double double If...
173,541
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Map numpy dtype to stata's default format for this type. Not terribly important since users can change this in Stata. Semantics are object -> "%DDs" where DD is the length of the string. If not a string, raise ValueError float64 -> "%10.0g" float32 -> "%9.0g" int64 -> "%9.0g" int32 -> "%12.0g" int16 -> "%8.0g" int8 -> ...
173,542
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Converts dtype types to stata types. Returns the byte of the given ordinal. See TYPE_MAP and comments for an explanation. This is also explained in the dta spec. 1 - 2045 are strings of this length Pandas Stata 32768 - for object strL 65526 - for int8 byte 65527 - for int16 int 65528 - for int32 long 65529 - for float3...
173,543
from __future__ import annotations from collections import abc import datetime from io import BytesIO import os import struct import sys from types import TracebackType from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Callable, Final, Hashable, Sequence, cast, ) import warnings f...
Takes a bytes instance and pads it with null bytes until it's length chars.
173,544
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Add engine to the excel writer registry.io.excel. You must use this method to integrate with ``to_excel``. Parameters ---------- klass : ExcelWriter
173,545
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Return the default reader/writer for the given extension. Parameters ---------- ext : str The excel file extension for which to get the default engine. mode : str {'reader', 'writer'} Whether to get the default engine for reading or writing. Either 'reader' or 'writer' Returns ------- str The default engine for the ext...
173,546
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,547
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,548
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,549
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,550
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,551
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Convert `usecols` into a compatible format for parsing in `parsers.py`. Parameters ---------- usecols : object The use-columns object to potentially convert. Returns ------- converted : object The compatible format of `usecols`.
173,552
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,553
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,554
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
null
173,555
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Forward fill blank entries in row but only inside the same parent index. Used for creating headers in Multiindex. Parameters ---------- row : list List of items in a single row. control_row : list of bool Helps to determine if particular column is in same parent index as the previous value. Used to stop propagation of ...
173,556
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Pop the header name for MultiIndex parsing. Parameters ---------- row : list The data row to parse for the header name. index_col : int, list The index columns for our data. Assumed to be non-null. Returns ------- header_name : str The extracted header name. trimmed_row : list The original data row with the header name...
173,557
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, MutableMapping, Sequence, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.common import ( is_integer,...
Used to combine two sources of kwargs for the backend engine. Use of kwargs is deprecated, this function is solely for use in 1.3 and should be removed in 1.4/2.0. Also _base.ExcelWriter.__new__ ensures either engine_kwargs or kwargs must be None or empty respectively. Parameters ---------- engine_kwargs: dict kwargs t...
173,558
from __future__ import annotations import abc import datetime from functools import partial from io import BytesIO import os from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Iterable, List, Literal, Mapping, Sequence, Uni...
null
173,559
from __future__ import annotations import abc import datetime from functools import partial from io import BytesIO import os from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Iterable, List, Literal, Mapping, Sequence, Uni...
null
173,560
from __future__ import annotations import abc import datetime from functools import partial from io import BytesIO import os from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Iterable, List, Literal, Mapping, Sequence, Uni...
null
173,561
from __future__ import annotations import abc import datetime from functools import partial from io import BytesIO import os from textwrap import fill from types import TracebackType from typing import ( IO, Any, Callable, Hashable, Iterable, List, Literal, Mapping, Sequence, Uni...
Inspect the path or content of an excel file and get its format. Adopted from xlrd: https://github.com/python-excel/xlrd. Parameters ---------- content_or_path : str or file-like object Path to file or content of file to inspect. May be a URL. {storage_options} Returns ------- str or None Format of file if it can be de...
173,562
from __future__ import annotations import sys def removesuffix(string: str, suffix: str) -> str: if string.endswith(suffix): return string[: -len(suffix)] return string
null
173,563
from __future__ import annotations import sys def removeprefix(string: str, prefix: str) -> str: if string.startswith(prefix): return string[len(prefix) :] return string
null
173,564
from __future__ import annotations import codecs import json import locale import os import platform import struct import sys from pandas._typing import JSONSerializable from pandas.compat._optional import ( VERSIONS, get_version, import_optional_dependency, ) def _get_sys_info() -> dict[str, JSONSerializab...
Provide useful information, important for bug reports. It comprises info about hosting operation system, pandas version, and versions of other installed relative packages. Parameters ---------- as_json : str or bool, default False * If False, outputs info in a human readable form to the console. * If str, it will be co...
173,565
from __future__ import annotations from functools import wraps import inspect from textwrap import dedent from typing import ( Any, Callable, Mapping, cast, ) import warnings from pandas._libs.properties import cache_readonly from pandas._typing import ( F, T, ) from pandas.util._exceptions impo...
Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated function will emit a deprecation warning, and in the docstring it will contain the deprecation directive with the provided versio...
173,566
from __future__ import annotations from functools import wraps import inspect from textwrap import dedent from typing import ( Any, Callable, Mapping, cast, ) import warnings from pandas._libs.properties import cache_readonly from pandas._typing import ( F, T, ) from pandas.util._exceptions impo...
Decorator to deprecate a keyword argument of a function. Parameters ---------- old_arg_name : str Name of argument in function to deprecate new_arg_name : str or None Name of preferred argument in function. Use None to raise warning that ``old_arg_name`` keyword is deprecated. mapping : dict or callable If mapping is p...
173,567
from __future__ import annotations from functools import wraps import inspect from textwrap import dedent from typing import ( Any, Callable, Mapping, cast, ) import warnings from pandas._libs.properties import cache_readonly from pandas._typing import ( F, T, ) from pandas.util._exceptions impo...
Decorator to deprecate a use of non-keyword arguments of a function. Parameters ---------- version : str, optional The version in which positional arguments will become keyword-only. If None, then the warning message won't specify any particular version. allowed_args : list, optional In case of list, it must be the lis...
173,568
from __future__ import annotations from functools import wraps import inspect from textwrap import dedent from typing import ( Any, Callable, Mapping, cast, ) import warnings from pandas._libs.properties import cache_readonly from pandas._typing import ( F, T, ) from pandas.util._exceptions impo...
A decorator take docstring templates, concatenate them and perform string substitution on it. This decorator will add a variable "_docstring_components" to the wrapped callable to keep track the original docstring template for potential usage. If it should be consider as a template, it will be saved as a string. Otherw...
173,569
from __future__ import annotations from functools import wraps import inspect from textwrap import dedent from typing import ( Any, Callable, Mapping, cast, ) import warnings from pandas._libs.properties import cache_readonly from pandas._typing import ( F, T, ) from pandas.util._exceptions impo...
null
173,570
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) def _check_arg_length(fname, args, max_fname_arg_count, compat_args): """ Checks...
Checks whether the length of the `*args` argument passed into a function has at most `len(compat_args)` arguments and whether or not all of these elements in `args` are set to their default values. Parameters ---------- fname : str The name of the function being passed the `*args` parameter args : tuple The `*args` par...
173,571
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) def _check_arg_length(fname, args, max_fname_arg_count, compat_args): """ Checks...
Checks whether parameters passed to the *args and **kwargs argument in a function `fname` are valid parameters as specified in `*compat_args` and whether or not they are set to their default values. Parameters ---------- fname: str The name of the function being passed the `**kwargs` parameter args: tuple The `*args` p...
173,572
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) def clean_fill_method(method: str | None, allow_nearest: bool = False): # asfreq is...
Validate the keyword arguments to 'fillna'. This checks that exactly one of 'value' and 'method' is specified. If 'method' is specified, this validates that it's a valid method. Parameters ---------- value, method : object The 'value' and 'method' keyword arguments for 'fillna'. validate_scalar_dict_value : bool, defau...
173,573
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) BoolishT = TypeVar("BoolishT", bool, int) def validate_ascending(ascending: BoolishT) -...
null
173,574
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) BoolishT = TypeVar("BoolishT", bool, int) class Sequence(_Collection[_T_co], Reversible...
null
173,575
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) BoolishT = TypeVar("BoolishT", bool, int) def validate_bool_kwarg( value: BoolishNon...
Validate ``ascending`` kwargs for ``sort_index`` method.
173,576
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) The provided code snippet includes necessary dependencies for implementing the `validat...
Check that the `closed` argument is among [None, "left", "right"] Parameters ---------- closed : {None, "left", "right"} Returns ------- left_closed : bool right_closed : bool Raises ------ ValueError : if argument is not among valid values
173,577
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) The provided code snippet includes necessary dependencies for implementing the `validat...
Check that the `inclusive` argument is among {"both", "neither", "left", "right"}. Parameters ---------- inclusive : {"both", "neither", "left", "right"} Returns ------- left_right_inclusive : tuple[bool, bool] Raises ------ ValueError : if argument is not among valid values
173,578
from __future__ import annotations from typing import ( Iterable, Sequence, TypeVar, overload, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import ( is_bool, is_integer, ) The provided code snippet includes necessary dependencies for implementing the `validat...
Check that we have an integer between -length and length, inclusive. Standardize negative loc to within [0, length]. The exceptions we raise on failure match np.insert.
173,579
from __future__ import annotations import contextlib import inspect import os import re from typing import Generator import warnings class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): def __next__(self) -> _T_co: ... def send(self, __value: _T_contra) -> _T_co: ... def throw( self,...
Rewrite the message of an exception.