neulab/docprompting-conala huggingface dataset:
pandas.api.types.union_categoricals   pandas.api.types.union_categoricals(to_union, sort_categories=False, ignore_order=False)[source]
 
Combine list-like of Categorical-like, unioning categories. All categories must have the same dtype.  Parameters 
 
to_union:list-like


Categorical, CategoricalIndex, or Series with dtype=’category’.  
sort_categories:bool, default False


If true, resulting categories will be lexsorted, otherwise they will be ordered as they appear in the data.  
ignore_order:bool, default False


If true, the ordered attribute of the Categoricals will be ignored. Results in an unordered categorical.    Returns 
 Categorical
  Raises 
 TypeError

 all inputs do not have the same dtype all inputs do not have the same ordered property all inputs are ordered and their categories are not identical sort_categories=True and Categoricals are ordered   ValueError

Empty list of categoricals passed     Notes To learn more about categories, see link Examples 
>>> from pandas.api.types import union_categoricals
  If you want to combine categoricals that do not necessarily have the same categories, union_categoricals will combine a list-like of categoricals. The new categories will be the union of the categories being combined. 
>>> a = pd.Categorical(["b", "c"])
>>> b = pd.Categorical(["a", "b"])
>>> union_categoricals([a, b])
['b', 'c', 'a', 'b']
Categories (3, object): ['b', 'c', 'a']
  By default, the resulting categories will be ordered as they appear in the categories of the data. If you want the categories to be lexsorted, use sort_categories=True argument. 
>>> union_categoricals([a, b], sort_categories=True)
['b', 'c', 'a', 'b']
Categories (3, object): ['a', 'b', 'c']
  union_categoricals also works with the case of combining two categoricals of the same categories and order information (e.g. what you could also append for). 
>>> a = pd.Categorical(["a", "b"], ordered=True)
>>> b = pd.Categorical(["a", "b", "a"], ordered=True)
>>> union_categoricals([a, b])
['a', 'b', 'a', 'b', 'a']
Categories (2, object): ['a' < 'b']
  Raises TypeError because the categories are ordered and not identical. 
>>> a = pd.Categorical(["a", "b"], ordered=True)
>>> b = pd.Categorical(["a", "b", "c"], ordered=True)
>>> union_categoricals([a, b])
Traceback (most recent call last):
    ...
TypeError: to union ordered Categoricals, all categories must be the same
  New in version 0.20.0 Ordered categoricals with different categories or orderings can be combined by using the ignore_ordered=True argument. 
>>> a = pd.Categorical(["a", "b", "c"], ordered=True)
>>> b = pd.Categorical(["c", "b", "a"], ordered=True)
>>> union_categoricals([a, b], ignore_order=True)
['a', 'b', 'c', 'c', 'b', 'a']
Categories (3, object): ['a', 'b', 'c']
  union_categoricals also works with a CategoricalIndex, or Series containing categorical data, but note that the resulting array will always be a plain Categorical 
>>> a = pd.Series(["b", "c"], dtype='category')
>>> b = pd.Series(["a", "b"], dtype='category')
>>> union_categoricals([a, b])
['b', 'c', 'a', 'b']
Categories (3, object): ['b', 'c', 'a']
pandas.arrays.ArrowStringArray   classpandas.arrays.ArrowStringArray(values)[source]
 
Extension array for string data in a pyarrow.ChunkedArray.  New in version 1.2.0.   Warning ArrowStringArray is considered experimental. The implementation and parts of the API may change without warning.   Parameters 
 
values:pyarrow.Array or pyarrow.ChunkedArray


The array of data.      See also  array

The recommended function for creating a ArrowStringArray.  Series.str

The string methods are available on Series backed by a ArrowStringArray.    Notes ArrowStringArray returns a BooleanArray for comparison methods. Examples 
>>> pd.array(['This is', 'some text', None, 'data.'], dtype="string[pyarrow]")
<ArrowStringArray>
['This is', 'some text', <NA>, 'data.']
Length: 4, dtype: string
  Attributes       
None     Methods       
None
pandas.arrays.BooleanArray   classpandas.arrays.BooleanArray(values, mask, copy=False)[source]
 
Array of boolean (True/False) data with missing values. This is a pandas Extension array for boolean data, under the hood represented by 2 numpy arrays: a boolean array with the data and a boolean array with the mask (True indicating missing). BooleanArray implements Kleene logic (sometimes called three-value logic) for logical operations. See Kleene logical operations for more. To construct an BooleanArray from generic array-like input, use pandas.array() specifying dtype="boolean" (see examples below).  New in version 1.0.0.   Warning BooleanArray is considered experimental. The implementation and parts of the API may change without warning.   Parameters 
 
values:numpy.ndarray


A 1-d boolean-dtype array with the data.  
mask:numpy.ndarray


A 1-d boolean-dtype array indicating missing values (True indicates missing).  
copy:bool, default False


Whether to copy the values and mask arrays.    Returns 
 BooleanArray
   Examples Create an BooleanArray with pandas.array(): 
>>> pd.array([True, False, None], dtype="boolean")
<BooleanArray>
[True, False, <NA>]
Length: 3, dtype: boolean
  Attributes       
None     Methods       
None
pandas.arrays.DatetimeArray   classpandas.arrays.DatetimeArray(values, dtype=dtype('<M8[ns]'), freq=None, copy=False)[source]
 
Pandas ExtensionArray for tz-naive or tz-aware datetime data.  Warning DatetimeArray is currently experimental, and its API may change without warning. In particular, DatetimeArray.dtype is expected to change to always be an instance of an ExtensionDtype subclass.   Parameters 
 
values:Series, Index, DatetimeArray, ndarray


The datetime data. For DatetimeArray values (or a Series or Index boxing one), dtype and freq will be extracted from values.  
dtype:numpy.dtype or DatetimeTZDtype


Note that the only NumPy dtype allowed is ‘datetime64[ns]’.  
freq:str or Offset, optional


The frequency.  
copy:bool, default False


Whether to copy the underlying array of values.     Attributes       
None     Methods       
None
pandas.arrays.IntegerArray   classpandas.arrays.IntegerArray(values, mask, copy=False)[source]
 
Array of integer (optional missing) values.  Changed in version 1.0.0: Now uses pandas.NA as the missing value rather than numpy.nan.   Warning IntegerArray is currently experimental, and its API or internal implementation may change without warning.  We represent an IntegerArray with 2 numpy arrays:  data: contains a numpy integer array of the appropriate dtype mask: a boolean array holding a mask on the data, True is missing  To construct an IntegerArray from generic array-like input, use pandas.array() with one of the integer dtypes (see examples). See Nullable integer data type for more.  Parameters 
 
values:numpy.ndarray


A 1-d integer-dtype array.  
mask:numpy.ndarray


A 1-d boolean-dtype array indicating missing values.  
copy:bool, default False


Whether to copy the values and mask.    Returns 
 IntegerArray
   Examples Create an IntegerArray with pandas.array(). 
>>> int_array = pd.array([1, None, 3], dtype=pd.Int32Dtype())
>>> int_array
<IntegerArray>
[1, <NA>, 3]
Length: 3, dtype: Int32
  String aliases for the dtypes are also available. They are capitalized. 
>>> pd.array([1, None, 3], dtype='Int32')
<IntegerArray>
[1, <NA>, 3]
Length: 3, dtype: Int32
  
>>> pd.array([1, None, 3], dtype='UInt16')
<IntegerArray>
[1, <NA>, 3]
Length: 3, dtype: UInt16
  Attributes       
None     Methods       
None
pandas.arrays.IntervalArray   classpandas.arrays.IntervalArray(data, closed=None, dtype=None, copy=False, verify_integrity=True)[source]
 
Pandas array for interval data that are closed on the same side.  New in version 0.24.0.   Parameters 
 
data:array-like (1-dimensional)


Array-like containing Interval objects from which to build the IntervalArray.  
closed:{‘left’, ‘right’, ‘both’, ‘neither’}, default ‘right’


Whether the intervals are closed on the left-side, right-side, both or neither.  
dtype:dtype or None, default None


If None, dtype will be inferred.  
copy:bool, default False


Copy the input data.  
verify_integrity:bool, default True


Verify that the IntervalArray is valid.      See also  Index

The base pandas Index type.  Interval

A bounded slice-like interval; the elements of an IntervalArray.  interval_range

Function to create a fixed frequency IntervalIndex.  cut

Bin values into discrete Intervals.  qcut

Bin values into equal-sized Intervals based on rank or sample quantiles.    Notes See the user guide for more. Examples A new IntervalArray can be constructed directly from an array-like of Interval objects: 
>>> pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
<IntervalArray>
[(0, 1], (1, 5]]
Length: 2, dtype: interval[int64, right]
  It may also be constructed using one of the constructor methods: IntervalArray.from_arrays(), IntervalArray.from_breaks(), and IntervalArray.from_tuples(). Attributes       
left Return the left endpoints of each Interval in the IntervalArray as an Index.  
right Return the right endpoints of each Interval in the IntervalArray as an Index.  
closed Whether the intervals are closed on the left-side, right-side, both or neither.  
mid Return the midpoint of each Interval in the IntervalArray as an Index.  
length Return an Index with entries denoting the length of each Interval in the IntervalArray.  
is_empty Indicates if an interval is empty, meaning it contains no points.  
is_non_overlapping_monotonic Return True if the IntervalArray is non-overlapping (no Intervals share points) and is either monotonic increasing or monotonic decreasing, else False.    Methods       
from_arrays(left, right[, closed, copy, dtype]) Construct from two arrays defining the left and right bounds.  
from_tuples(data[, closed, copy, dtype]) Construct an IntervalArray from an array-like of tuples.  
from_breaks(breaks[, closed, copy, dtype]) Construct an IntervalArray from an array of splits.  
contains(other) Check elementwise if the Intervals contain the value.  
overlaps(other) Check elementwise if an Interval overlaps the values in the IntervalArray.  
set_closed(closed) Return an IntervalArray identical to the current one, but closed on the specified side.  
to_tuples([na_tuple]) Return an ndarray of tuples of the form (left, right).
pandas.arrays.IntervalArray.closed   propertyIntervalArray.closed
 
Whether the intervals are closed on the left-side, right-side, both or neither.
pandas.arrays.IntervalArray.contains   IntervalArray.contains(other)[source]
 
Check elementwise if the Intervals contain the value. Return a boolean mask whether the value is contained in the Intervals of the IntervalArray.  New in version 0.25.0.   Parameters 
 
other:scalar


The value to check whether it is contained in the Intervals.    Returns 
 boolean array
    See also  Interval.contains

Check whether Interval object contains value.  IntervalArray.overlaps

Check if an Interval overlaps the values in the IntervalArray.    Examples 
>>> intervals = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 3), (2, 4)])
>>> intervals
<IntervalArray>
[(0, 1], (1, 3], (2, 4]]
Length: 3, dtype: interval[int64, right]
  
>>> intervals.contains(0.5)
array([ True, False, False])
pandas.arrays.IntervalArray.from_arrays   classmethodIntervalArray.from_arrays(left, right, closed='right', copy=False, dtype=None)[source]
 
Construct from two arrays defining the left and right bounds.  Parameters 
 
left:array-like (1-dimensional)


Left bounds for each interval.  
right:array-like (1-dimensional)


Right bounds for each interval.  
closed:{‘left’, ‘right’, ‘both’, ‘neither’}, default ‘right’


Whether the intervals are closed on the left-side, right-side, both or neither.  
copy:bool, default False


Copy the data.  
dtype:dtype, optional


If None, dtype will be inferred.    Returns 
 IntervalArray
  Raises 
 ValueError

When a value is missing in only one of left or right. When a value in left is greater than the corresponding value in right.      See also  interval_range

Function to create a fixed frequency IntervalIndex.  IntervalArray.from_breaks

Construct an IntervalArray from an array of splits.  IntervalArray.from_tuples

Construct an IntervalArray from an array-like of tuples.    Notes Each element of left must be less than or equal to the right element at the same position. If an element is missing, it must be missing in both left and right. A TypeError is raised when using an unsupported type for left or right. At the moment, ‘category’, ‘object’, and ‘string’ subtypes are not supported. 
>>> pd.arrays.IntervalArray.from_arrays([0, 1, 2], [1, 2, 3])
<IntervalArray>
[(0, 1], (1, 2], (2, 3]]
Length: 3, dtype: interval[int64, right]
pandas.arrays.IntervalArray.from_breaks   classmethodIntervalArray.from_breaks(breaks, closed='right', copy=False, dtype=None)[source]
 
Construct an IntervalArray from an array of splits.  Parameters 
 
breaks:array-like (1-dimensional)


Left and right bounds for each interval.  
closed:{‘left’, ‘right’, ‘both’, ‘neither’}, default ‘right’


Whether the intervals are closed on the left-side, right-side, both or neither.  
copy:bool, default False


Copy the data.  
dtype:dtype or None, default None


If None, dtype will be inferred.    Returns 
 IntervalArray
    See also  interval_range

Function to create a fixed frequency IntervalIndex.  IntervalArray.from_arrays

Construct from a left and right array.  IntervalArray.from_tuples

Construct from a sequence of tuples.    Examples 
>>> pd.arrays.IntervalArray.from_breaks([0, 1, 2, 3])
<IntervalArray>
[(0, 1], (1, 2], (2, 3]]
Length: 3, dtype: interval[int64, right]
pandas.arrays.IntervalArray.from_tuples   classmethodIntervalArray.from_tuples(data, closed='right', copy=False, dtype=None)[source]
 
Construct an IntervalArray from an array-like of tuples.  Parameters 
 
data:array-like (1-dimensional)


Array of tuples.  
closed:{‘left’, ‘right’, ‘both’, ‘neither’}, default ‘right’


Whether the intervals are closed on the left-side, right-side, both or neither.  
copy:bool, default False


By-default copy the data, this is compat only and ignored.  
dtype:dtype or None, default None


If None, dtype will be inferred.    Returns 
 IntervalArray
    See also  interval_range

Function to create a fixed frequency IntervalIndex.  IntervalArray.from_arrays

Construct an IntervalArray from a left and right array.  IntervalArray.from_breaks

Construct an IntervalArray from an array of splits.    Examples 
>>> pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)])
<IntervalArray>
[(0, 1], (1, 2]]
Length: 2, dtype: interval[int64, right]
pandas.arrays.IntervalArray.is_empty   IntervalArray.is_empty
 
Indicates if an interval is empty, meaning it contains no points.  New in version 0.25.0.   Returns 
 bool or ndarray

A boolean indicating if a scalar Interval is empty, or a boolean ndarray positionally indicating if an Interval in an IntervalArray or IntervalIndex is empty.     Examples An Interval that contains points is not empty: 
>>> pd.Interval(0, 1, closed='right').is_empty
False
  An Interval that does not contain any points is empty: 
>>> pd.Interval(0, 0, closed='right').is_empty
True
>>> pd.Interval(0, 0, closed='left').is_empty
True
>>> pd.Interval(0, 0, closed='neither').is_empty
True
  An Interval that contains a single point is not empty: 
>>> pd.Interval(0, 0, closed='both').is_empty
False
  An IntervalArray or IntervalIndex returns a boolean ndarray positionally indicating if an Interval is empty: 
>>> ivs = [pd.Interval(0, 0, closed='neither'),
...        pd.Interval(1, 2, closed='neither')]
>>> pd.arrays.IntervalArray(ivs).is_empty
array([ True, False])
  Missing values are not considered empty: 
>>> ivs = [pd.Interval(0, 0, closed='neither'), np.nan]
>>> pd.IntervalIndex(ivs).is_empty
array([ True, False])
pandas.arrays.IntervalArray.is_non_overlapping_monotonic   propertyIntervalArray.is_non_overlapping_monotonic
 
Return True if the IntervalArray is non-overlapping (no Intervals share points) and is either monotonic increasing or monotonic decreasing, else False.
pandas.arrays.IntervalArray.left   propertyIntervalArray.left
 
Return the left endpoints of each Interval in the IntervalArray as an Index.
pandas.arrays.IntervalArray.length   propertyIntervalArray.length
 
Return an Index with entries denoting the length of each Interval in the IntervalArray.
pandas.arrays.IntervalArray.mid   propertyIntervalArray.mid
 
Return the midpoint of each Interval in the IntervalArray as an Index.
pandas.arrays.IntervalArray.overlaps   IntervalArray.overlaps(other)[source]
 
Check elementwise if an Interval overlaps the values in the IntervalArray. Two intervals overlap if they share a common point, including closed endpoints. Intervals that only have an open endpoint in common do not overlap.  Parameters 
 
other:IntervalArray


Interval to check against for an overlap.    Returns 
 ndarray

Boolean array positionally indicating where an overlap occurs.      See also  Interval.overlaps

Check whether two Interval objects overlap.    Examples 
>>> data = [(0, 1), (1, 3), (2, 4)]
>>> intervals = pd.arrays.IntervalArray.from_tuples(data)
>>> intervals
<IntervalArray>
[(0, 1], (1, 3], (2, 4]]
Length: 3, dtype: interval[int64, right]
  
>>> intervals.overlaps(pd.Interval(0.5, 1.5))
array([ True,  True, False])
  Intervals that share closed endpoints overlap: 
>>> intervals.overlaps(pd.Interval(1, 3, closed='left'))
array([ True,  True, True])
  Intervals that only have an open endpoint in common do not overlap: 
>>> intervals.overlaps(pd.Interval(1, 2, closed='right'))
array([False,  True, False])
pandas.arrays.IntervalArray.right   propertyIntervalArray.right
 
Return the right endpoints of each Interval in the IntervalArray as an Index.
pandas.arrays.IntervalArray.set_closed   IntervalArray.set_closed(closed)[source]
 
Return an IntervalArray identical to the current one, but closed on the specified side.  Parameters 
 
closed:{‘left’, ‘right’, ‘both’, ‘neither’}


Whether the intervals are closed on the left-side, right-side, both or neither.    Returns 
 
new_index:IntervalArray

   Examples 
>>> index = pd.arrays.IntervalArray.from_breaks(range(4))
>>> index
<IntervalArray>
[(0, 1], (1, 2], (2, 3]]
Length: 3, dtype: interval[int64, right]
>>> index.set_closed('both')
<IntervalArray>
[[0, 1], [1, 2], [2, 3]]
Length: 3, dtype: interval[int64, both]
pandas.arrays.IntervalArray.to_tuples   IntervalArray.to_tuples(na_tuple=True)[source]
 
Return an ndarray of tuples of the form (left, right).  Parameters 
 
na_tuple:bool, default True


Returns NA as a tuple if True, (nan, nan), or just as the NA value itself if False, nan.    Returns 
 tuples: ndarray
pandas.arrays.PandasArray   classpandas.arrays.PandasArray(values, copy=False)[source]
 
A pandas ExtensionArray for NumPy data. This is mostly for internal compatibility, and is not especially useful on its own.  Parameters 
 
values:ndarray


The NumPy ndarray to wrap. Must be 1-dimensional.  
copy:bool, default False


Whether to copy values.     Attributes       
None     Methods       
None
pandas.arrays.PeriodArray   classpandas.arrays.PeriodArray(values, dtype=None, freq=None, copy=False)[source]
 
Pandas ExtensionArray for storing Period data. Users should use period_array() to create new instances. Alternatively, array() can be used to create new instances from a sequence of Period scalars.  Parameters 
 
values:Union[PeriodArray, Series[period], ndarray[int], PeriodIndex]


The data to store. These should be arrays that can be directly converted to ordinals without inference or copy (PeriodArray, ndarray[int64]), or a box around such an array (Series[period], PeriodIndex).  
dtype:PeriodDtype, optional


A PeriodDtype instance from which to extract a freq. If both freq and dtype are specified, then the frequencies must match.  
freq:str or DateOffset


The freq to use for the array. Mostly applicable when values is an ndarray of integers, when freq is required. When values is a PeriodArray (or box around), it’s checked that values.freq matches freq.  
copy:bool, default False


Whether to copy the ordinals before storing.      See also  Period

Represents a period of time.  PeriodIndex

Immutable Index for period data.  period_range

Create a fixed-frequency PeriodArray.  array

Construct a pandas array.    Notes There are two components to a PeriodArray  ordinals : integer ndarray freq : pd.tseries.offsets.Offset  The values are physically stored as a 1-D ndarray of integers. These are called “ordinals” and represent some kind of offset from a base. The freq indicates the span covered by each element of the array. All elements in the PeriodArray have the same freq. Attributes       
None     Methods       
None
pandas.arrays.SparseArray   classpandas.arrays.SparseArray(data, sparse_index=None, index=None, fill_value=None, kind='integer', dtype=None, copy=False)[source]
 
An ExtensionArray for storing sparse data.  Parameters 
 
data:array-like or scalar


A dense array of values to store in the SparseArray. This may contain fill_value.  
sparse_index:SparseIndex, optional


index:Index


 Deprecated since version 1.4.0: Use a function like np.full to construct an array with the desired repeats of the scalar value instead.   
fill_value:scalar, optional


Elements in data that are fill_value are not stored in the SparseArray. For memory savings, this should be the most common value in data. By default, fill_value depends on the dtype of data:       
data.dtype na_value    
float np.nan  
int 0  
bool False  
datetime64 pd.NaT  
timedelta64 pd.NaT    The fill value is potentially specified in three ways. In order of precedence, these are  The fill_value argument dtype.fill_value if fill_value is None and dtype is a SparseDtype data.dtype.fill_value if fill_value is None and dtype is not a SparseDtype and data is a SparseArray.   
kind:str


Can be ‘integer’ or ‘block’, default is ‘integer’. The type of storage for sparse locations.  ‘block’: Stores a block and block_length for each contiguous span of sparse values. This is best when sparse data tends to be clumped together, with large regions of fill-value values between sparse values. ‘integer’: uses an integer to store the location of each sparse value.   
dtype:np.dtype or SparseDtype, optional


The dtype to use for the SparseArray. For numpy dtypes, this determines the dtype of self.sp_values. For SparseDtype, this determines self.sp_values and self.fill_value.  
copy:bool, default False


Whether to explicitly copy the incoming data array.     Examples 
>>> from pandas.arrays import SparseArray
>>> arr = SparseArray([0, 0, 1, 2])
>>> arr
[0, 0, 1, 2]
Fill: 0
IntIndex
Indices: array([2, 3], dtype=int32)
  Attributes       
None     Methods       
None
pandas.arrays.StringArray   classpandas.arrays.StringArray(values, copy=False)[source]
 
Extension array for string data.  New in version 1.0.0.   Warning StringArray is considered experimental. The implementation and parts of the API may change without warning.   Parameters 
 
values:array-like


The array of data.  Warning Currently, this expects an object-dtype ndarray where the elements are Python strings or pandas.NA. This may change without warning in the future. Use pandas.array() with dtype="string" for a stable way of creating a StringArray from any sequence.   
copy:bool, default False


Whether to copy the array of data.      See also  array

The recommended function for creating a StringArray.  Series.str

The string methods are available on Series backed by a StringArray.    Notes StringArray returns a BooleanArray for comparison methods. Examples 
>>> pd.array(['This is', 'some text', None, 'data.'], dtype="string")
<StringArray>
['This is', 'some text', <NA>, 'data.']
Length: 4, dtype: string
  Unlike arrays instantiated with dtype="object", StringArray will convert the values to strings. 
>>> pd.array(['1', 1], dtype="object")
<PandasArray>
['1', 1]
Length: 2, dtype: object
>>> pd.array(['1', 1], dtype="string")
<StringArray>
['1', '1']
Length: 2, dtype: string
  However, instantiating StringArrays directly with non-strings will raise an error. For comparison methods, StringArray returns a pandas.BooleanArray: 
>>> pd.array(["a", None, "c"], dtype="string") == "a"
<BooleanArray>
[True, <NA>, False]
Length: 3, dtype: boolean
  Attributes       
None     Methods       
None