neulab/docprompting-conala huggingface dataset:
pandas.DataFrame.rank   DataFrame.rank(axis=0, method='average', numeric_only=NoDefault.no_default, na_option='keep', ascending=True, pct=False)[source]
 
Compute numerical data ranks (1 through n) along axis. By default, equal values are assigned a rank that is the average of the ranks of those values.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Index to direct ranking.  
method:{‘average’, ‘min’, ‘max’, ‘first’, ‘dense’}, default ‘average’


How to rank the group of records that have the same value (i.e. ties):  average: average rank of the group min: lowest rank in the group max: highest rank in the group first: ranks assigned in order they appear in the array dense: like ‘min’, but rank always increases by 1 between groups.   
numeric_only:bool, optional


For DataFrame objects, rank only numeric columns if set to True.  
na_option:{‘keep’, ‘top’, ‘bottom’}, default ‘keep’


How to rank NaN values:  keep: assign NaN rank to NaN values top: assign lowest rank to NaN values bottom: assign highest rank to NaN values   
ascending:bool, default True


Whether or not the elements should be ranked in ascending order.  
pct:bool, default False


Whether or not to display the returned rankings in percentile form.    Returns 
 same type as caller

Return a Series or DataFrame with data ranks as values.      See also  core.groupby.GroupBy.rank

Rank of values within each group.    Examples 
>>> df = pd.DataFrame(data={'Animal': ['cat', 'penguin', 'dog',
...                                    'spider', 'snake'],
...                         'Number_legs': [4, 2, 4, 8, np.nan]})
>>> df
    Animal  Number_legs
0      cat          4.0
1  penguin          2.0
2      dog          4.0
3   spider          8.0
4    snake          NaN
  The following example shows how the method behaves with the above parameters:  default_rank: this is the default behaviour obtained without using any parameter. max_rank: setting method = 'max' the records that have the same values are ranked using the highest rank (e.g.: since ‘cat’ and ‘dog’ are both in the 2nd and 3rd position, rank 3 is assigned.) NA_bottom: choosing na_option = 'bottom', if there are records with NaN values they are placed at the bottom of the ranking. pct_rank: when setting pct = True, the ranking is expressed as percentile rank.  
>>> df['default_rank'] = df['Number_legs'].rank()
>>> df['max_rank'] = df['Number_legs'].rank(method='max')
>>> df['NA_bottom'] = df['Number_legs'].rank(na_option='bottom')
>>> df['pct_rank'] = df['Number_legs'].rank(pct=True)
>>> df
    Animal  Number_legs  default_rank  max_rank  NA_bottom  pct_rank
0      cat          4.0           2.5       3.0        2.5     0.625
1  penguin          2.0           1.0       1.0        1.0     0.250
2      dog          4.0           2.5       3.0        2.5     0.625
3   spider          8.0           4.0       4.0        4.0     1.000
4    snake          NaN           NaN       NaN        5.0       NaN
pandas.DataFrame.rename   DataFrame.rename(mapper=None, *, index=None, columns=None, axis=None, copy=True, inplace=False, level=None, errors='ignore')[source]
 
Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don’t throw an error. See the user guide for more.  Parameters 
 
mapper:dict-like or function


Dict-like or function transformations to apply to that axis’ values. Use either mapper and axis to specify the axis to target with mapper, or index and columns.  
index:dict-like or function


Alternative to specifying axis (mapper, axis=0 is equivalent to index=mapper).  
columns:dict-like or function


Alternative to specifying axis (mapper, axis=1 is equivalent to columns=mapper).  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Axis to target with mapper. Can be either the axis name (‘index’, ‘columns’) or number (0, 1). The default is ‘index’.  
copy:bool, default True


Also copy underlying data.  
inplace:bool, default False


Whether to return a new DataFrame. If True then value of copy is ignored.  
level:int or level name, default None


In case of a MultiIndex, only rename labels in the specified level.  
errors:{‘ignore’, ‘raise’}, default ‘ignore’


If ‘raise’, raise a KeyError when a dict-like mapper, index, or columns contains labels that are not present in the Index being transformed. If ‘ignore’, existing keys will be renamed and extra keys will be ignored.    Returns 
 DataFrame or None

DataFrame with the renamed axis labels or None if inplace=True.    Raises 
 KeyError

If any of the labels is not found in the selected axis and “errors=’raise’”.      See also  DataFrame.rename_axis

Set the name of the axis.    Examples DataFrame.rename supports two calling conventions  (index=index_mapper, columns=columns_mapper, ...) (mapper, axis={'index', 'columns'}, ...)  We highly recommend using keyword arguments to clarify your intent. Rename columns using a mapping: 
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
>>> df.rename(columns={"A": "a", "B": "c"})
   a  c
0  1  4
1  2  5
2  3  6
  Rename index using a mapping: 
>>> df.rename(index={0: "x", 1: "y", 2: "z"})
   A  B
x  1  4
y  2  5
z  3  6
  Cast index labels to a different type: 
>>> df.index
RangeIndex(start=0, stop=3, step=1)
>>> df.rename(index=str).index
Index(['0', '1', '2'], dtype='object')
  
>>> df.rename(columns={"A": "a", "B": "b", "C": "c"}, errors="raise")
Traceback (most recent call last):
KeyError: ['C'] not found in axis
  Using axis-style parameters: 
>>> df.rename(str.lower, axis='columns')
   a  b
0  1  4
1  2  5
2  3  6
  
>>> df.rename({1: 2, 2: 4}, axis='index')
   A  B
0  1  4
2  2  5
4  3  6
pandas.DataFrame.reorder_levels   DataFrame.reorder_levels(order, axis=0)[source]
 
Rearrange index levels using input order. May not drop or duplicate levels.  Parameters 
 
order:list of int or list of str


List representing new level order. Reference level by number (position) or by key (label).  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Where to reorder levels.    Returns 
 DataFrame
   Examples 
>>> data = {
...     "class": ["Mammals", "Mammals", "Reptiles"],
...     "diet": ["Omnivore", "Carnivore", "Carnivore"],
...     "species": ["Humans", "Dogs", "Snakes"],
... }
>>> df = pd.DataFrame(data, columns=["class", "diet", "species"])
>>> df = df.set_index(["class", "diet"])
>>> df
                                  species
class      diet
Mammals    Omnivore                Humans
           Carnivore                 Dogs
Reptiles   Carnivore               Snakes
  Let’s reorder the levels of the index: 
>>> df.reorder_levels(["diet", "class"])
                                  species
diet      class
Omnivore  Mammals                  Humans
Carnivore Mammals                    Dogs
          Reptiles                 Snakes
pandas.DataFrame.round   DataFrame.round(decimals=0, *args, **kwargs)[source]
 
Round a DataFrame to a variable number of decimal places.  Parameters 
 
decimals:int, dict, Series


Number of decimal places to round each column to. If an int is given, round each column to the same number of places. Otherwise dict and Series round to variable numbers of places. Column names should be in the keys if decimals is a dict-like, or in the index if decimals is a Series. Any columns not included in decimals will be left as is. Elements of decimals which are not columns of the input will be ignored.  *args

Additional keywords have no effect but might be accepted for compatibility with numpy.  **kwargs

Additional keywords have no effect but might be accepted for compatibility with numpy.    Returns 
 DataFrame

A DataFrame with the affected columns rounded to the specified number of decimal places.      See also  numpy.around

Round a numpy array to the given number of decimals.  Series.round

Round a Series to the given number of decimals.    Examples 
>>> df = pd.DataFrame([(.21, .32), (.01, .67), (.66, .03), (.21, .18)],
...                   columns=['dogs', 'cats'])
>>> df
    dogs  cats
0  0.21  0.32
1  0.01  0.67
2  0.66  0.03
3  0.21  0.18
  By providing an integer each column is rounded to the same number of decimal places 
>>> df.round(1)
    dogs  cats
0   0.2   0.3
1   0.0   0.7
2   0.7   0.0
3   0.2   0.2
  With a dict, the number of places for specific columns can be specified with the column names as key and the number of decimal places as value 
>>> df.round({'dogs': 1, 'cats': 0})
    dogs  cats
0   0.2   0.0
1   0.0   1.0
2   0.7   0.0
3   0.2   0.0
  Using a Series, the number of places for specific columns can be specified with the column names as index and the number of decimal places as value 
>>> decimals = pd.Series([0, 1], index=['cats', 'dogs'])
>>> df.round(decimals)
    dogs  cats
0   0.2   0.0
1   0.0   1.0
2   0.7   0.0
3   0.2   0.0
pandas.DataFrame.select_dtypes   DataFrame.select_dtypes(include=None, exclude=None)[source]
 
Return a subset of the DataFrame’s columns based on the column dtypes.  Parameters 
 
include, exclude:scalar or list-like


A selection of dtypes or strings to be included/excluded. At least one of these parameters must be supplied.    Returns 
 DataFrame

The subset of the frame including the dtypes in include and excluding the dtypes in exclude.    Raises 
 ValueError

 If both of include and exclude are empty If include and exclude have overlapping elements If any kind of string dtype is passed in.       See also  DataFrame.dtypes

Return Series with the data type of each column.    Notes  To select all numeric types, use np.number or 'number' To select strings you must use the object dtype, but note that this will return all object dtype columns See the numpy dtype hierarchy To select datetimes, use np.datetime64, 'datetime' or 'datetime64' To select timedeltas, use np.timedelta64, 'timedelta' or 'timedelta64' To select Pandas categorical dtypes, use 'category' To select Pandas datetimetz dtypes, use 'datetimetz' (new in 0.20.0) or 'datetime64[ns, tz]'  Examples 
>>> df = pd.DataFrame({'a': [1, 2] * 3,
...                    'b': [True, False] * 3,
...                    'c': [1.0, 2.0] * 3})
>>> df
        a      b  c
0       1   True  1.0
1       2  False  2.0
2       1   True  1.0
3       2  False  2.0
4       1   True  1.0
5       2  False  2.0
  
>>> df.select_dtypes(include='bool')
   b
0  True
1  False
2  True
3  False
4  True
5  False
  
>>> df.select_dtypes(include=['float64'])
   c
0  1.0
1  2.0
2  1.0
3  2.0
4  1.0
5  2.0
  
>>> df.select_dtypes(exclude=['int64'])
       b    c
0   True  1.0
1  False  2.0
2   True  1.0
3  False  2.0
4   True  1.0
5  False  2.0
pandas.DataFrame.sem   DataFrame.sem(axis=None, skipna=True, level=None, ddof=1, numeric_only=None, **kwargs)[source]
 
Return unbiased standard error of the mean over requested axis. Normalized by N-1 by default. This can be changed using the ddof argument  Parameters 
 
axis:{index (0), columns (1)}


skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series.  
ddof:int, default 1


Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.  
numeric_only:bool, default None


Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.    Returns 
 Series or DataFrame (if level specified)
pandas.DataFrame.set_axis   DataFrame.set_axis(labels, axis=0, inplace=False)[source]
 
Assign desired index to given axis. Indexes for column or row labels can be changed by assigning a list-like or Index.  Parameters 
 
labels:list-like, Index


The values for the new index.  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to update. The value 0 identifies the rows, and 1 identifies the columns.  
inplace:bool, default False


Whether to return a new DataFrame instance.    Returns 
 
renamed:DataFrame or None


An object of type DataFrame or None if inplace=True.      See also  DataFrame.rename_axis

Alter the name of the index or columns.    Examples 
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
  Change the row labels. 
>>> df.set_axis(['a', 'b', 'c'], axis='index')
   A  B
a  1  4
b  2  5
c  3  6
  Change the column labels. 
>>> df.set_axis(['I', 'II'], axis='columns')
   I  II
0  1   4
1  2   5
2  3   6
  Now, update the labels inplace. 
>>> df.set_axis(['i', 'ii'], axis='columns', inplace=True)
>>> df
   i  ii
0  1   4
1  2   5
2  3   6
pandas.DataFrame.set_flags   DataFrame.set_flags(*, copy=False, allows_duplicate_labels=None)[source]
 
Return a new object with updated flags.  Parameters 
 
allows_duplicate_labels:bool, optional


Whether the returned object allows duplicate labels.    Returns 
 Series or DataFrame

The same type as the caller.      See also  DataFrame.attrs

Global metadata applying to this dataset.  DataFrame.flags

Global flags applying to this object.    Notes This method returns a new object that’s a view on the same data as the input. Mutating the input or the output values will be reflected in the other. This method is intended to be used in method chains. “Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs. Examples 
>>> df = pd.DataFrame({"A": [1, 2]})
>>> df.flags.allows_duplicate_labels
True
>>> df2 = df.set_flags(allows_duplicate_labels=False)
>>> df2.flags.allows_duplicate_labels
False
pandas.DataFrame.set_index   DataFrame.set_index(keys, drop=True, append=False, inplace=False, verify_integrity=False)[source]
 
Set the DataFrame index using existing columns. Set the DataFrame index (row labels) using one or more existing columns or arrays (of the correct length). The index can replace the existing index or expand on it.  Parameters 
 
keys:label or array-like or list of labels/arrays


This parameter can be either a single column key, a single array of the same length as the calling DataFrame, or a list containing an arbitrary combination of column keys and arrays. Here, “array” encompasses Series, Index, np.ndarray, and instances of Iterator.  
drop:bool, default True


Delete columns to be used as the new index.  
append:bool, default False


Whether to append columns to existing index.  
inplace:bool, default False


If True, modifies the DataFrame in place (do not create a new object).  
verify_integrity:bool, default False


Check the new index for duplicates. Otherwise defer the check until necessary. Setting to False will improve the performance of this method.    Returns 
 DataFrame or None

Changed row labels or None if inplace=True.      See also  DataFrame.reset_index

Opposite of set_index.  DataFrame.reindex

Change to new indices or expand indices.  DataFrame.reindex_like

Change to same indices as other DataFrame.    Examples 
>>> df = pd.DataFrame({'month': [1, 4, 7, 10],
...                    'year': [2012, 2014, 2013, 2014],
...                    'sale': [55, 40, 84, 31]})
>>> df
   month  year  sale
0      1  2012    55
1      4  2014    40
2      7  2013    84
3     10  2014    31
  Set the index to become the ‘month’ column: 
>>> df.set_index('month')
       year  sale
month
1      2012    55
4      2014    40
7      2013    84
10     2014    31
  Create a MultiIndex using columns ‘year’ and ‘month’: 
>>> df.set_index(['year', 'month'])
            sale
year  month
2012  1     55
2014  4     40
2013  7     84
2014  10    31
  Create a MultiIndex using an Index and a column: 
>>> df.set_index([pd.Index([1, 2, 3, 4]), 'year'])
         month  sale
   year
1  2012  1      55
2  2014  4      40
3  2013  7      84
4  2014  10     31
  Create a MultiIndex using two Series: 
>>> s = pd.Series([1, 2, 3, 4])
>>> df.set_index([s, s**2])
      month  year  sale
1 1       1  2012    55
2 4       4  2014    40
3 9       7  2013    84
4 16     10  2014    31
pandas.DataFrame.shape   propertyDataFrame.shape
 
Return a tuple representing the dimensionality of the DataFrame.  See also  ndarray.shape

Tuple of array dimensions.    Examples 
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.shape
(2, 2)
  
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4],
...                    'col3': [5, 6]})
>>> df.shape
(2, 3)
pandas.DataFrame.size   propertyDataFrame.size
 
Return an int representing the number of elements in this object. Return the number of rows if Series. Otherwise return the number of rows times number of columns if DataFrame.  See also  ndarray.size

Number of elements in the array.    Examples 
>>> s = pd.Series({'a': 1, 'b': 2, 'c': 3})
>>> s.size
3
  
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.size
4
pandas.DataFrame.skew   DataFrame.skew(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return unbiased skew over requested axis. Normalized by N-1.  Parameters 
 
axis:{index (0), columns (1)}


Axis for the function to be applied on.  
skipna:bool, default True


Exclude NA/null values when computing the result.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series.  
numeric_only:bool, default None


Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns 
 Series or DataFrame (if level specified)
pandas.DataFrame.slice_shift   DataFrame.slice_shift(periods=1, axis=0)[source]
 
Equivalent to shift without copying data. The shifted data will not include the dropped periods and the shifted axis will be smaller than the original.  Deprecated since version 1.2.0: slice_shift is deprecated, use DataFrame/Series.shift instead.   Parameters 
 
periods:int


Number of periods to move, can be positive or negative.    Returns 
 
shifted:same type as caller

   Notes While the slice_shift is faster than shift, you may pay for it later during alignment.
pandas.DataFrame.sort_index   DataFrame.sort_index(axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True, ignore_index=False, key=None)[source]
 
Sort object by labels (along an axis). Returns a new DataFrame sorted by label if inplace argument is False, otherwise updates the original DataFrame and returns None.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis along which to sort. The value 0 identifies the rows, and 1 identifies the columns.  
level:int or level name or list of ints or list of level names


If not None, sort on values in specified index level(s).  
ascending:bool or list-like of bools, default True


Sort ascending vs. descending. When the index is a MultiIndex the sort direction can be controlled for each level individually.  
inplace:bool, default False


If True, perform operation in-place.  
kind:{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, default ‘quicksort’


Choice of sorting algorithm. See also numpy.sort() for more information. mergesort and stable are the only stable algorithms. For DataFrames, this option is only applied when sorting on a single column or label.  
na_position:{‘first’, ‘last’}, default ‘last’


Puts NaNs at the beginning if first; last puts NaNs at the end. Not implemented for MultiIndex.  
sort_remaining:bool, default True


If True and sorting by level and index is multilevel, sort by other levels too (in order) after sorting by specified level.  
ignore_index:bool, default False


If True, the resulting axis will be labeled 0, 1, …, n - 1.  New in version 1.0.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. For MultiIndex inputs, the key is applied per level.  New in version 1.1.0.     Returns 
 DataFrame or None

The original DataFrame sorted by the labels or None if inplace=True.      See also  Series.sort_index

Sort Series by the index.  DataFrame.sort_values

Sort DataFrame by the value.  Series.sort_values

Sort Series by the value.    Examples 
>>> df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
...                   columns=['A'])
>>> df.sort_index()
     A
1    4
29   2
100  1
150  5
234  3
  By default, it sorts in ascending order, to sort in descending order, use ascending=False 
>>> df.sort_index(ascending=False)
     A
234  3
150  5
100  1
29   2
1    4
  A key function can be specified which is applied to the index before sorting. For a MultiIndex this is applied to each level separately. 
>>> df = pd.DataFrame({"a": [1, 2, 3, 4]}, index=['A', 'b', 'C', 'd'])
>>> df.sort_index(key=lambda x: x.str.lower())
   a
A  1
b  2
C  3
d  4
pandas.DataFrame.sparse   DataFrame.sparse()[source]
 
DataFrame accessor for sparse data.  New in version 0.25.0.
pandas.DataFrame.sparse.density   DataFrame.sparse.density
 
Ratio of non-sparse points to total (dense) data points.
pandas.DataFrame.sparse.from_spmatrix   classmethodDataFrame.sparse.from_spmatrix(data, index=None, columns=None)[source]
 
Create a new DataFrame from a scipy sparse matrix.  New in version 0.25.0.   Parameters 
 
data:scipy.sparse.spmatrix


Must be convertible to csc format.  
index, columns:Index, optional


Row and column labels to use for the resulting DataFrame. Defaults to a RangeIndex.    Returns 
 DataFrame

Each column of the DataFrame is stored as a arrays.SparseArray.     Examples 
>>> import scipy.sparse
>>> mat = scipy.sparse.eye(3)
>>> pd.DataFrame.sparse.from_spmatrix(mat)
     0    1    2
0  1.0  0.0  0.0
1  0.0  1.0  0.0
2  0.0  0.0  1.0
pandas.DataFrame.sparse.to_coo   DataFrame.sparse.to_coo()[source]
 
Return the contents of the frame as a sparse SciPy COO matrix.  New in version 0.25.0.   Returns 
 
coo_matrix:scipy.sparse.spmatrix


If the caller is heterogeneous and contains booleans or objects, the result will be of dtype=object. See Notes.     Notes The dtype will be the lowest-common-denominator type (implicit upcasting); that is to say if the dtypes (even of numeric types) are mixed, the one that accommodates all will be chosen. e.g. If the dtypes are float16 and float32, dtype will be upcast to float32. By numpy.find_common_type convention, mixing int64 and and uint64 will result in a float64 dtype.
pandas.DataFrame.sparse.to_dense   DataFrame.sparse.to_dense()[source]
 
Convert a DataFrame with sparse values to dense.  New in version 0.25.0.   Returns 
 DataFrame

A DataFrame with the same values stored as dense arrays.     Examples 
>>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0])})
>>> df.sparse.to_dense()
   A
0  0
1  1
2  0