neulab/docprompting-conala huggingface dataset:
pandas.Index.set_names   Index.set_names(names, level=None, inplace=False)[source]
 
Set Index or MultiIndex name. Able to set new names partially and by level.  Parameters 
 
names:label or list of label or dict-like for MultiIndex


Name(s) to set.  Changed in version 1.3.0.   
level:int, label or list of int or label, optional


If the index is a MultiIndex and names is not dict-like, level(s) to set (None for all levels). Otherwise level must be None.  Changed in version 1.3.0.   
inplace:bool, default False


Modifies the object directly, instead of creating a new Index or MultiIndex.    Returns 
 Index or None

The same type as the caller or None if inplace=True.      See also  Index.rename

Able to set new names without level.    Examples 
>>> idx = pd.Index([1, 2, 3, 4])
>>> idx
Int64Index([1, 2, 3, 4], dtype='int64')
>>> idx.set_names('quarter')
Int64Index([1, 2, 3, 4], dtype='int64', name='quarter')
  
>>> idx = pd.MultiIndex.from_product([['python', 'cobra'],
...                                   [2018, 2019]])
>>> idx
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           )
>>> idx.set_names(['kind', 'year'], inplace=True)
>>> idx
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['kind', 'year'])
>>> idx.set_names('species', level=0)
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['species', 'year'])
  When renaming levels with a dict, levels can not be passed. 
>>> idx.set_names({'kind': 'snake'})
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['snake', 'year'])
pandas.Index.set_value   finalIndex.set_value(arr, key, value)[source]
 
Fast lookup of value from 1-dimensional ndarray.  Deprecated since version 1.0.  Notes Only use this if you know what you’re doing.
pandas.Index.shape   propertyIndex.shape
 
Return a tuple of the shape of the underlying data.
pandas.Index.shift   Index.shift(periods=1, freq=None)[source]
 
Shift index by desired number of time frequency increments. This method is for shifting the values of datetime-like indexes by a specified time increment a given number of times.  Parameters 
 
periods:int, default 1


Number of periods (or increments) to shift by, can be positive or negative.  
freq:pandas.DateOffset, pandas.Timedelta or str, optional


Frequency increment to shift by. If None, the index is shifted by its own freq attribute. Offset aliases are valid strings, e.g., ‘D’, ‘W’, ‘M’ etc.    Returns 
 pandas.Index

Shifted index.      See also  Series.shift

Shift values of Series.    Notes This method is only implemented for datetime-like index classes, i.e., DatetimeIndex, PeriodIndex and TimedeltaIndex. Examples Put the first 5 month starts of 2011 into an index. 
>>> month_starts = pd.date_range('1/1/2011', periods=5, freq='MS')
>>> month_starts
DatetimeIndex(['2011-01-01', '2011-02-01', '2011-03-01', '2011-04-01',
               '2011-05-01'],
              dtype='datetime64[ns]', freq='MS')
  Shift the index by 10 days. 
>>> month_starts.shift(10, freq='D')
DatetimeIndex(['2011-01-11', '2011-02-11', '2011-03-11', '2011-04-11',
               '2011-05-11'],
              dtype='datetime64[ns]', freq=None)
  The default value of freq is the freq attribute of the index, which is ‘MS’ (month start) in this example. 
>>> month_starts.shift(10)
DatetimeIndex(['2011-11-01', '2011-12-01', '2012-01-01', '2012-02-01',
               '2012-03-01'],
              dtype='datetime64[ns]', freq='MS')
pandas.Index.size   propertyIndex.size
 
Return the number of elements in the underlying data.
pandas.Index.slice_indexer   Index.slice_indexer(start=None, end=None, step=None, kind=NoDefault.no_default)[source]
 
Compute the slice indexer for input labels and step. Index needs to be ordered and unique.  Parameters 
 
start:label, default None


If None, defaults to the beginning.  
end:label, default None


If None, defaults to the end.  
step:int, default None


kind:str, default None


 Deprecated since version 1.4.0.     Returns 
 
indexer:slice

  Raises 
 
KeyError:If key does not exist, or key is not unique and index is


not ordered.     Notes This function assumes that the data is sorted, so use at your own peril Examples This is a method on all index types. For example you can do: 
>>> idx = pd.Index(list('abcd'))
>>> idx.slice_indexer(start='b', end='c')
slice(1, 3, None)
  
>>> idx = pd.MultiIndex.from_arrays([list('abcd'), list('efgh')])
>>> idx.slice_indexer(start='b', end=('c', 'g'))
slice(1, 3, None)
pandas.Index.slice_locs   Index.slice_locs(start=None, end=None, step=None, kind=NoDefault.no_default)[source]
 
Compute slice locations for input labels.  Parameters 
 
start:label, default None


If None, defaults to the beginning.  
end:label, default None


If None, defaults to the end.  
step:int, defaults None


If None, defaults to 1.  
kind:{‘loc’, ‘getitem’} or None


 Deprecated since version 1.4.0.     Returns 
 
start, end:int

    See also  Index.get_loc

Get location for a single label.    Notes This method only works if the index is monotonic or unique. Examples 
>>> idx = pd.Index(list('abcd'))
>>> idx.slice_locs(start='b', end='c')
(1, 3)
pandas.Index.sort   finalIndex.sort(*args, **kwargs)[source]
 
Use sort_values instead.
pandas.Index.sort_values   Index.sort_values(return_indexer=False, ascending=True, na_position='last', key=None)[source]
 
Return a sorted copy of the index. Return a sorted copy of the index, and optionally return the indices that sorted the index itself.  Parameters 
 
return_indexer:bool, default False


Should the indices that would sort the index be returned.  
ascending:bool, default True


Should the index values be sorted in an ascending order.  
na_position:{‘first’ or ‘last’}, default ‘last’


Argument ‘first’ puts NaNs at the beginning, ‘last’ puts NaNs at the end.  New in version 1.2.0.   
key:callable, optional


If not None, apply the key function to the index values before sorting. This is similar to the key argument in the builtin sorted() function, with the notable difference that this key function should be vectorized. It should expect an Index and return an Index of the same shape.  New in version 1.1.0.     Returns 
 
sorted_index:pandas.Index


Sorted copy of the index.  
indexer:numpy.ndarray, optional


The indices that the index itself was sorted by.      See also  Series.sort_values

Sort values of a Series.  DataFrame.sort_values

Sort values in a DataFrame.    Examples 
>>> idx = pd.Index([10, 100, 1, 1000])
>>> idx
Int64Index([10, 100, 1, 1000], dtype='int64')
  Sort values in ascending order (default behavior). 
>>> idx.sort_values()
Int64Index([1, 10, 100, 1000], dtype='int64')
  Sort values in descending order, and also get the indices idx was sorted by. 
>>> idx.sort_values(ascending=False, return_indexer=True)
(Int64Index([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2]))
pandas.Index.sortlevel   Index.sortlevel(level=None, ascending=True, sort_remaining=None)[source]
 
For internal compatibility with the Index API. Sort the Index. This is for compat with MultiIndex  Parameters 
 
ascending:bool, default True


False to sort in descending order  level, sort_remaining are compat parameters
  Returns 
 Index
pandas.Index.str   Index.str()[source]
 
Vectorized string functions for Series and Index. NAs stay NA unless handled otherwise by a particular method. Patterned after Python’s string methods, with some inspiration from R’s stringr package. Examples 
>>> s = pd.Series(["A_Str_Series"])
>>> s
0    A_Str_Series
dtype: object
  
>>> s.str.split("_")
0    [A, Str, Series]
dtype: object
  
>>> s.str.replace("_", "")
0    AStrSeries
dtype: object
pandas.Index.symmetric_difference   Index.symmetric_difference(other, result_name=None, sort=None)[source]
 
Compute the symmetric difference of two Index objects.  Parameters 
 
other:Index or array-like


result_name:str


sort:False or None, default None


Whether to sort the resulting index. By default, the values are attempted to be sorted, but any TypeError from incomparable elements is caught by pandas.  None : Attempt to sort the result, but catch any TypeErrors from comparing incomparable elements. False : Do not sort the result.     Returns 
 
symmetric_difference:Index

   Notes symmetric_difference contains elements that appear in either idx1 or idx2 but not both. Equivalent to the Index created by idx1.difference(idx2) | idx2.difference(idx1) with duplicates dropped. Examples 
>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([2, 3, 4, 5])
>>> idx1.symmetric_difference(idx2)
Int64Index([1, 5], dtype='int64')
pandas.Index.T   propertyIndex.T
 
Return the transpose, which is by definition self.
pandas.Index.take   Index.take(indices, axis=0, allow_fill=True, fill_value=None, **kwargs)[source]
 
Return a new Index of the values selected by the indices. For internal compatibility with numpy arrays.  Parameters 
 
indices:array-like


Indices to be taken.  
axis:int, optional


The axis over which to select values, always 0.  
allow_fill:bool, default True


fill_value:scalar, default None


If allow_fill=True and fill_value is not None, indices specified by -1 are regarded as NA. If Index doesn’t hold NA, raise ValueError.    Returns 
 Index

An index formed of elements at the given indices. Will be the same type as self, except for RangeIndex.      See also  numpy.ndarray.take

Return an array formed from the elements of a at the given indices.
pandas.Index.to_flat_index   Index.to_flat_index()[source]
 
Identity method. This is implemented for compatibility with subclass implementations when chaining.  Returns 
 pd.Index

Caller.      See also  MultiIndex.to_flat_index

Subclass implementation.
pandas.Index.to_frame   Index.to_frame(index=True, name=NoDefault.no_default)[source]
 
Create a DataFrame with a column containing the Index.  Parameters 
 
index:bool, default True


Set the index of the returned DataFrame as the original Index.  
name:object, default None


The passed name should substitute for the index name (if it has one).    Returns 
 DataFrame

DataFrame containing the original Index data.      See also  Index.to_series

Convert an Index to a Series.  Series.to_frame

Convert Series to DataFrame.    Examples 
>>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
>>> idx.to_frame()
       animal
animal
Ant       Ant
Bear     Bear
Cow       Cow
  By default, the original Index is reused. To enforce a new Index: 
>>> idx.to_frame(index=False)
    animal
0   Ant
1  Bear
2   Cow
  To override the name of the resulting column, specify name: 
>>> idx.to_frame(index=False, name='zoo')
    zoo
0   Ant
1  Bear
2   Cow
pandas.Index.to_list   Index.to_list()[source]
 
Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period)  Returns 
 list
    See also  numpy.ndarray.tolist

Return the array as an a.ndim-levels deep nested list of Python scalars.
pandas.Index.to_native_types   finalIndex.to_native_types(slicer=None, **kwargs)[source]
 
Format specified values of self and return them.  Deprecated since version 1.2.0.   Parameters 
 
slicer:int, array-like


An indexer into self that specifies which values are used in the formatting process.  
kwargs:dict


Options for specifying how the values should be formatted. These options include the following:  
 na_rep:str


The value that serves as a placeholder for NULL values    
 quoting:bool or None


Whether or not there are quoted values in self    
 date_format:str


The format used to represent date-like values.        Returns 
 numpy.ndarray

Formatted values.
pandas.Index.to_numpy   Index.to_numpy(dtype=None, copy=False, na_value=NoDefault.no_default, **kwargs)[source]
 
A NumPy ndarray representing the values in this Series or Index.  Parameters 
 
dtype:str or numpy.dtype, optional


The dtype to pass to numpy.asarray().  
copy:bool, default False


Whether to ensure that the returned value is not a view on another array. Note that copy=False does not ensure that to_numpy() is no-copy. Rather, copy=True ensure that a copy is made, even if not strictly necessary.  
na_value:Any, optional


The value to use for missing values. The default value depends on dtype and the type of the array.  New in version 1.0.0.   **kwargs

Additional keywords passed through to the to_numpy method of the underlying array (for extension arrays).  New in version 1.0.0.     Returns 
 numpy.ndarray
    See also  Series.array

Get the actual data stored within.  Index.array

Get the actual data stored within.  DataFrame.to_numpy

Similar method for DataFrame.    Notes The returned array will be the same up to equality (values equal in self will be equal in the returned array; likewise for values that are not equal). When self contains an ExtensionArray, the dtype may be different. For example, for a category-dtype Series, to_numpy() will return a NumPy array and the categorical dtype will be lost. For NumPy dtypes, this will be a reference to the actual data stored in this Series or Index (assuming copy=False). Modifying the result in place will modify the data stored in the Series or Index (not that we recommend doing that). For extension types, to_numpy() may require copying data and coercing the result to a NumPy type (possibly object), which may be expensive. When you need a no-copy reference to the underlying data, Series.array should be used instead. This table lays out the different dtypes and default return types of to_numpy() for various dtypes within pandas.       
dtype array type    
category[T] ndarray[T] (same dtype as input)  
period ndarray[object] (Periods)  
interval ndarray[object] (Intervals)  
IntegerNA ndarray[object]  
datetime64[ns] datetime64[ns]  
datetime64[ns, tz] ndarray[object] (Timestamps)    Examples 
>>> ser = pd.Series(pd.Categorical(['a', 'b', 'a']))
>>> ser.to_numpy()
array(['a', 'b', 'a'], dtype=object)
  Specify the dtype to control how datetime-aware data is represented. Use dtype=object to return an ndarray of pandas Timestamp objects, each with the correct tz. 
>>> ser = pd.Series(pd.date_range('2000', periods=2, tz="CET"))
>>> ser.to_numpy(dtype=object)
array([Timestamp('2000-01-01 00:00:00+0100', tz='CET'),
       Timestamp('2000-01-02 00:00:00+0100', tz='CET')],
      dtype=object)
  Or dtype='datetime64[ns]' to return an ndarray of native datetime64 values. The values are converted to UTC and the timezone info is dropped. 
>>> ser.to_numpy(dtype="datetime64[ns]")
... 
array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00...'],
      dtype='datetime64[ns]')
pandas.Index.to_series   Index.to_series(index=None, name=None)[source]
 
Create a Series with both index and values equal to the index keys. Useful with map for returning an indexer based on an index.  Parameters 
 
index:Index, optional


Index of resulting Series. If None, defaults to original index.  
name:str, optional


Name of resulting Series. If None, defaults to name of original index.    Returns 
 Series

The dtype will be based on the type of the Index values.      See also  Index.to_frame

Convert an Index to a DataFrame.  Series.to_frame

Convert Series to DataFrame.    Examples 
>>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
  By default, the original Index and original name is reused. 
>>> idx.to_series()
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: animal, dtype: object
  To enforce a new Index, specify new labels to index: 
>>> idx.to_series(index=[0, 1, 2])
0     Ant
1    Bear
2     Cow
Name: animal, dtype: object
  To override the name of the resulting column, specify name: 
>>> idx.to_series(name='zoo')
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: zoo, dtype: object
pandas.Index.tolist   Index.tolist()[source]
 
Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period)  Returns 
 list
    See also  numpy.ndarray.tolist

Return the array as an a.ndim-levels deep nested list of Python scalars.
pandas.Index.transpose   Index.transpose(*args, **kwargs)[source]
 
Return the transpose, which is by definition self.  Returns 
 %(klass)s
pandas.Index.union   finalIndex.union(other, sort=None)[source]
 
Form the union of two Index objects. If the Index objects are incompatible, both Index objects will be cast to dtype(‘object’) first.  
 Changed in version 0.25.0.  
  Parameters 
 
other:Index or array-like


sort:bool or None, default None


Whether to sort the resulting Index.  
None : Sort the result, except when  self and other are equal. self or other has length 0. Some values in self or other cannot be compared. A RuntimeWarning is issued in this case.   False : do not sort the result.     Returns 
 
union:Index

   Examples Union matching dtypes 
>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([3, 4, 5, 6])
>>> idx1.union(idx2)
Int64Index([1, 2, 3, 4, 5, 6], dtype='int64')
  Union mismatched dtypes 
>>> idx1 = pd.Index(['a', 'b', 'c', 'd'])
>>> idx2 = pd.Index([1, 2, 3, 4])
>>> idx1.union(idx2)
Index(['a', 'b', 'c', 'd', 1, 2, 3, 4], dtype='object')
  MultiIndex case 
>>> idx1 = pd.MultiIndex.from_arrays(
...     [[1, 1, 2, 2], ["Red", "Blue", "Red", "Blue"]]
... )
>>> idx1
MultiIndex([(1,  'Red'),
    (1, 'Blue'),
    (2,  'Red'),
    (2, 'Blue')],
   )
>>> idx2 = pd.MultiIndex.from_arrays(
...     [[3, 3, 2, 2], ["Red", "Green", "Red", "Green"]]
... )
>>> idx2
MultiIndex([(3,   'Red'),
    (3, 'Green'),
    (2,   'Red'),
    (2, 'Green')],
   )
>>> idx1.union(idx2)
MultiIndex([(1,  'Blue'),
    (1,   'Red'),
    (2,  'Blue'),
    (2, 'Green'),
    (2,   'Red'),
    (3, 'Green'),
    (3,   'Red')],
   )
>>> idx1.union(idx2, sort=False)
MultiIndex([(1,   'Red'),
    (1,  'Blue'),
    (2,   'Red'),
    (2,  'Blue'),
    (3,   'Red'),
    (3, 'Green'),
    (2, 'Green')],
   )
pandas.Index.unique   Index.unique(level=None)[source]
 
Return unique values in the index. Unique values are returned in order of appearance, this does NOT sort.  Parameters 
 
level:int or hashable, optional


Only return values from specified level (for MultiIndex). If int, gets the level by integer position, else by level name.    Returns 
 Index
    See also  unique

Numpy array of unique values in that column.  Series.unique

Return unique values of Series object.
pandas.Index.value_counts   Index.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True)[source]
 
Return a Series containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occurring element. Excludes NA values by default.  Parameters 
 
normalize:bool, default False


If True then the object returned will contain the relative frequencies of the unique values.  
sort:bool, default True


Sort by frequencies.  
ascending:bool, default False


Sort in ascending order.  
bins:int, optional


Rather than count values, group them into half-open bins, a convenience for pd.cut, only works with numeric data.  
dropna:bool, default True


Don’t include counts of NaN.    Returns 
 Series
    See also  Series.count

Number of non-NA elements in a Series.  DataFrame.count

Number of non-NA elements in a DataFrame.  DataFrame.value_counts

Equivalent method on DataFrames.    Examples 
>>> index = pd.Index([3, 1, 2, 3, 4, np.nan])
>>> index.value_counts()
3.0    2
1.0    1
2.0    1
4.0    1
dtype: int64
  With normalize set to True, returns the relative frequency by dividing all values by the sum of values. 
>>> s = pd.Series([3, 1, 2, 3, 4, np.nan])
>>> s.value_counts(normalize=True)
3.0    0.4
1.0    0.2
2.0    0.2
4.0    0.2
dtype: float64
  bins Bins can be useful for going from a continuous variable to a categorical variable; instead of counting unique apparitions of values, divide the index in the specified number of half-open bins. 
>>> s.value_counts(bins=3)
(0.996, 2.0]    2
(2.0, 3.0]      2
(3.0, 4.0]      1
dtype: int64
  dropna With dropna set to False we can also see NaN index values. 
>>> s.value_counts(dropna=False)
3.0    2
1.0    1
2.0    1
4.0    1
NaN    1
dtype: int64
pandas.Index.values   propertyIndex.values
 
Return an array representing the data in the Index.  Warning We recommend using Index.array or Index.to_numpy(), depending on whether you need a reference to the underlying data or a NumPy array.   Returns 
 array: numpy.ndarray or ExtensionArray
    See also  Index.array

Reference to the underlying data.  Index.to_numpy

A NumPy array representing the underlying data.
pandas.Index.where   finalIndex.where(cond, other=None)[source]
 
Replace values where the condition is False. The replacement is taken from other.  Parameters 
 
cond:bool array-like with the same length as self


Condition to select the values on.  
other:scalar, or array-like, default None


Replacement if the condition is False.    Returns 
 pandas.Index

A copy of self with values replaced from other where the condition is False.      See also  Series.where

Same method for Series.  DataFrame.where

Same method for DataFrame.    Examples 
>>> idx = pd.Index(['car', 'bike', 'train', 'tractor'])
>>> idx
Index(['car', 'bike', 'train', 'tractor'], dtype='object')
>>> idx.where(idx.isin(['car', 'train']), 'other')
Index(['car', 'other', 'train', 'other'], dtype='object')
pandas.IndexSlice   pandas.IndexSlice=<pandas.core.indexing._IndexSlice object>
 
Create an object to more easily perform multi-index slicing.  See also  MultiIndex.remove_unused_levels

New MultiIndex with no unused levels.    Notes See Defined Levels for further info on slicing a MultiIndex. Examples 
>>> midx = pd.MultiIndex.from_product([['A0','A1'], ['B0','B1','B2','B3']])
>>> columns = ['foo', 'bar']
>>> dfmi = pd.DataFrame(np.arange(16).reshape((len(midx), len(columns))),
...                     index=midx, columns=columns)
  Using the default slice command: 
>>> dfmi.loc[(slice(None), slice('B0', 'B1')), :]
           foo  bar
    A0 B0    0    1
       B1    2    3
    A1 B0    8    9
       B1   10   11
  Using the IndexSlice class for a more intuitive command: 
>>> idx = pd.IndexSlice
>>> dfmi.loc[idx[:, 'B0':'B1'], :]
           foo  bar
    A0 B0    0    1
       B1    2    3
    A1 B0    8    9
       B1   10   11
pandas.infer_freq   pandas.infer_freq(index, warn=True)[source]
 
Infer the most likely frequency given the input index. If the frequency is uncertain, a warning will be printed.  Parameters 
 
index:DatetimeIndex or TimedeltaIndex


If passed a Series will use the values of the series (NOT THE INDEX).  
warn:bool, default True

  Returns 
 str or None

None if no discernible frequency.    Raises 
 TypeError

If the index is not datetime-like.  ValueError

If there are fewer than three values.     Examples 
>>> idx = pd.date_range(start='2020/12/01', end='2020/12/30', periods=30)
>>> pd.infer_freq(idx)
'D'
pandas.Int16Dtype   classpandas.Int16Dtype[source]
 
An ExtensionDtype for int16 integer data.  Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.  Attributes       
None     Methods       
None
pandas.Int32Dtype   classpandas.Int32Dtype[source]
 
An ExtensionDtype for int32 integer data.  Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.  Attributes       
None     Methods       
None
pandas.Int64Dtype   classpandas.Int64Dtype[source]
 
An ExtensionDtype for int64 integer data.  Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.  Attributes       
None     Methods       
None