neulab/docprompting-conala huggingface dataset:
pandas.Series.subtract   Series.subtract(other, level=None, fill_value=None, axis=0)[source]
 
Return Subtraction of series and other, element-wise (binary operator sub). Equivalent to series - other, but with support to substitute a fill_value for missing data in either one of the inputs.  Parameters 
 
other:Series or scalar value


fill_value:None or float value, default None (NaN)


Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.  
level:int or name


Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns 
 Series

The result of the operation.      See also  Series.rsub

Reverse of the Subtraction operator, see Python documentation for more details.    Examples 
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.subtract(b, fill_value=0)
a    0.0
b    1.0
c    1.0
d   -1.0
e    NaN
dtype: float64
pandas.Series.sum   Series.sum(axis=None, skipna=True, level=None, numeric_only=None, min_count=0, **kwargs)[source]
 
Return the sum of the values over the requested axis. This is equivalent to the method numpy.sum.  Parameters 
 
axis:{index (0)}


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 scalar.  
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.  
min_count:int, default 0


The required number of valid values to perform the operation. If fewer than min_count non-NA values are present the result will be NA.  **kwargs

Additional keyword arguments to be passed to the function.    Returns 
 scalar or Series (if level specified)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples 
>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64
  
>>> s.sum()
14
  By default, the sum of an empty or all-NA Series is 0. 
>>> pd.Series([], dtype="float64").sum()  # min_count=0 is the default
0.0
  This can be controlled with the min_count parameter. For example, if you’d like the sum of an empty series to be NaN, pass min_count=1. 
>>> pd.Series([], dtype="float64").sum(min_count=1)
nan
  Thanks to the skipna parameter, min_count handles all-NA and empty series identically. 
>>> pd.Series([np.nan]).sum()
0.0
  
>>> pd.Series([np.nan]).sum(min_count=1)
nan
pandas.Series.swapaxes   Series.swapaxes(axis1, axis2, copy=True)[source]
 
Interchange axes and swap values axes appropriately.  Returns 
 
y:same as input
pandas.Series.swaplevel   Series.swaplevel(i=- 2, j=- 1, copy=True)[source]
 
Swap levels i and j in a MultiIndex. Default is to swap the two innermost levels of the index.  Parameters 
 
i, j:int or str


Levels of the indices to be swapped. Can pass level name as string.  
copy:bool, default True


Whether to copy underlying data.    Returns 
 Series

Series with levels swapped in MultiIndex.     Examples 
>>> s = pd.Series(
...     ["A", "B", "A", "C"],
...     index=[
...         ["Final exam", "Final exam", "Coursework", "Coursework"],
...         ["History", "Geography", "History", "Geography"],
...         ["January", "February", "March", "April"],
...     ],
... )
>>> s
Final exam  History     January      A
            Geography   February     B
Coursework  History     March        A
            Geography   April        C
dtype: object
  In the following example, we will swap the levels of the indices. Here, we will swap the levels column-wise, but levels can be swapped row-wise in a similar manner. Note that column-wise is the default behaviour. By not supplying any arguments for i and j, we swap the last and second to last indices. 
>>> s.swaplevel()
Final exam  January     History         A
            February    Geography       B
Coursework  March       History         A
            April       Geography       C
dtype: object
  By supplying one argument, we can choose which index to swap the last index with. We can for example swap the first index with the last one as follows. 
>>> s.swaplevel(0)
January     History     Final exam      A
February    Geography   Final exam      B
March       History     Coursework      A
April       Geography   Coursework      C
dtype: object
  We can also define explicitly which indices we want to swap by supplying values for both i and j. Here, we for example swap the first and second indices. 
>>> s.swaplevel(0, 1)
History     Final exam  January         A
Geography   Final exam  February        B
History     Coursework  March           A
Geography   Coursework  April           C
dtype: object
pandas.Series.T   propertySeries.T
 
Return the transpose, which is by definition self.
pandas.Series.tail   Series.tail(n=5)[source]
 
Return the last n rows. This function returns last n rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows. For negative values of n, this function returns all rows except the first n rows, equivalent to df[n:].  Parameters 
 
n:int, default 5


Number of rows to select.    Returns 
 type of caller

The last n rows of the caller object.      See also  DataFrame.head

The first n rows of the caller object.    Examples 
>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
...                    'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey
5     parrot
6      shark
7      whale
8      zebra
  Viewing the last 5 lines 
>>> df.tail()
   animal
4  monkey
5  parrot
6   shark
7   whale
8   zebra
  Viewing the last n lines (three in this case) 
>>> df.tail(3)
  animal
6  shark
7  whale
8  zebra
  For negative values of n 
>>> df.tail(-3)
   animal
3    lion
4  monkey
5  parrot
6   shark
7   whale
8   zebra
pandas.Series.take   Series.take(indices, axis=0, is_copy=None, **kwargs)[source]
 
Return the elements in the given positional indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object.  Parameters 
 
indices:array-like


An array of ints indicating which positions to take.  
axis:{0 or ‘index’, 1 or ‘columns’, None}, default 0


The axis on which to select elements. 0 means that we are selecting rows, 1 means that we are selecting columns.  
is_copy:bool


Before pandas 1.0, is_copy=False can be specified to ensure that the return value is an actual copy. Starting with pandas 1.0, take always returns a copy, and the keyword is therefore deprecated.  Deprecated since version 1.0.0.   **kwargs

For compatibility with numpy.take(). Has no effect on the output.    Returns 
 
taken:same type as caller


An array-like containing the elements taken from the object.      See also  DataFrame.loc

Select a subset of a DataFrame by labels.  DataFrame.iloc

Select a subset of a DataFrame by positions.  numpy.take

Take elements from an array along an axis.    Examples 
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
...                    ('parrot', 'bird', 24.0),
...                    ('lion', 'mammal', 80.5),
...                    ('monkey', 'mammal', np.nan)],
...                   columns=['name', 'class', 'max_speed'],
...                   index=[0, 2, 3, 1])
>>> df
     name   class  max_speed
0  falcon    bird      389.0
2  parrot    bird       24.0
3    lion  mammal       80.5
1  monkey  mammal        NaN
  Take elements at positions 0 and 3 along the axis 0 (default). Note how the actual indices selected (0 and 1) do not correspond to our selected indices 0 and 3. That’s because we are selecting the 0th and 3rd rows, not rows whose indices equal 0 and 3. 
>>> df.take([0, 3])
     name   class  max_speed
0  falcon    bird      389.0
1  monkey  mammal        NaN
  Take elements at indices 1 and 2 along the axis 1 (column selection). 
>>> df.take([1, 2], axis=1)
    class  max_speed
0    bird      389.0
2    bird       24.0
3  mammal       80.5
1  mammal        NaN
  We may take elements using negative integers for positive indices, starting from the end of the object, just like with Python lists. 
>>> df.take([-1, -2])
     name   class  max_speed
1  monkey  mammal        NaN
3    lion  mammal       80.5
pandas.Series.to_clipboard   Series.to_clipboard(excel=True, sep=None, **kwargs)[source]
 
Copy object to the system clipboard. Write a text representation of object to the system clipboard. This can be pasted into Excel, for example.  Parameters 
 
excel:bool, default True


Produce output in a csv format for easy pasting into excel.  True, use the provided separator for csv pasting. False, write a string representation of the object to the clipboard.   
sep:str, default '\t'


Field delimiter.  **kwargs

These parameters will be passed to DataFrame.to_csv.      See also  DataFrame.to_csv

Write a DataFrame to a comma-separated values (csv) file.  read_clipboard

Read text from clipboard and pass to read_csv.    Notes Requirements for your platform.  
 Linux : xclip, or xsel (with PyQt4 modules) Windows : none macOS : none  
 Examples Copy the contents of a DataFrame to the clipboard. 
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C'])
  
>>> df.to_clipboard(sep=',')  
... # Wrote the following to the system clipboard:
... # ,A,B,C
... # 0,1,2,3
... # 1,4,5,6
  We can omit the index by passing the keyword index and setting it to false. 
>>> df.to_clipboard(sep=',', index=False)  
... # Wrote the following to the system clipboard:
... # A,B,C
... # 1,2,3
... # 4,5,6
pandas.Series.to_dict   Series.to_dict(into=<class 'dict'>)[source]
 
Convert Series to {label -> value} dict or dict-like object.  Parameters 
 
into:class, default dict


The collections.abc.Mapping subclass to use as the return object. Can be the actual class or an empty instance of the mapping type you want. If you want a collections.defaultdict, you must pass it initialized.    Returns 
 collections.abc.Mapping

Key-value representation of Series.     Examples 
>>> s = pd.Series([1, 2, 3, 4])
>>> s.to_dict()
{0: 1, 1: 2, 2: 3, 3: 4}
>>> from collections import OrderedDict, defaultdict
>>> s.to_dict(OrderedDict)
OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)])
>>> dd = defaultdict(list)
>>> s.to_dict(dd)
defaultdict(<class 'list'>, {0: 1, 1: 2, 2: 3, 3: 4})
pandas.Series.to_frame   Series.to_frame(name=NoDefault.no_default)[source]
 
Convert Series to DataFrame.  Parameters 
 
name:object, optional


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

DataFrame representation of Series.     Examples 
>>> s = pd.Series(["a", "b", "c"],
...               name="vals")
>>> s.to_frame()
  vals
0    a
1    b
2    c
pandas.Series.to_list   Series.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.Series.to_markdown   Series.to_markdown(buf=None, mode='wt', index=True, storage_options=None, **kwargs)[source]
 
Print Series in Markdown-friendly format.  New in version 1.0.0.   Parameters 
 
buf:str, Path or StringIO-like, optional, default None


Buffer to write to. If None, the output is returned as a string.  
mode:str, optional


Mode in which file is opened, “wt” by default.  
index:bool, optional, default True


Add index (row) labels.  New in version 1.1.0.   
storage_options:dict, optional


Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.   **kwargs

These parameters will be passed to tabulate.    Returns 
 str

Series in Markdown-friendly format.     Notes Requires the tabulate package. Examples 
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
>>> print(s.to_markdown())
|    | animal   |
|---:|:---------|
|  0 | elk      |
|  1 | pig      |
|  2 | dog      |
|  3 | quetzal  |
  Output markdown with a tabulate option. 
>>> print(s.to_markdown(tablefmt="grid"))
+----+----------+
|    | animal   |
+====+==========+
|  0 | elk      |
+----+----------+
|  1 | pig      |
+----+----------+
|  2 | dog      |
+----+----------+
|  3 | quetzal  |
+----+----------+
pandas.Series.to_numpy   Series.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.Series.to_period   Series.to_period(freq=None, copy=True)[source]
 
Convert Series from DatetimeIndex to PeriodIndex.  Parameters 
 
freq:str, default None


Frequency associated with the PeriodIndex.  
copy:bool, default True


Whether or not to return a copy.    Returns 
 Series

Series with index converted to PeriodIndex.
pandas.Series.to_pickle   Series.to_pickle(path, compression='infer', protocol=5, storage_options=None)[source]
 
Pickle (serialize) object to file.  Parameters 
 
path:str


File path where the pickled object will be stored.  
compression:str or dict, default ‘infer’


For on-the-fly compression of the output data. If ‘infer’ and ‘path’ path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, ‘.xz’, or ‘.zst’ (otherwise no compression). Set to None for no compression. Can also be a dict with key 'method' set to one of {'zip', 'gzip', 'bz2', 'zstd'} and other key-value pairs are forwarded to zipfile.ZipFile, gzip.GzipFile, bz2.BZ2File, or zstandard.ZstdDecompressor, respectively. As an example, the following could be passed for faster compression and to create a reproducible gzip archive: compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}.  
protocol:int


Int which indicates which protocol should be used by the pickler, default HIGHEST_PROTOCOL (see [1] paragraph 12.1.2). The possible values are 0, 1, 2, 3, 4, 5. A negative value for the protocol parameter is equivalent to setting its value to HIGHEST_PROTOCOL.  1 
https://docs.python.org/3/library/pickle.html.    
storage_options:dict, optional


Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.       See also  read_pickle

Load pickled pandas object (or any object) from file.  DataFrame.to_hdf

Write DataFrame to an HDF5 file.  DataFrame.to_sql

Write DataFrame to a SQL database.  DataFrame.to_parquet

Write a DataFrame to the binary parquet format.    Examples 
>>> original_df = pd.DataFrame({"foo": range(5), "bar": range(5, 10)})  
>>> original_df  
   foo  bar
0    0    5
1    1    6
2    2    7
3    3    8
4    4    9
>>> original_df.to_pickle("./dummy.pkl")  
  
>>> unpickled_df = pd.read_pickle("./dummy.pkl")  
>>> unpickled_df  
   foo  bar
0    0    5
1    1    6
2    2    7
3    3    8
4    4    9
pandas.Series.to_string   Series.to_string(buf=None, na_rep='NaN', float_format=None, header=True, index=True, length=False, dtype=False, name=False, max_rows=None, min_rows=None)[source]
 
Render a string representation of the Series.  Parameters 
 
buf:StringIO-like, optional


Buffer to write to.  
na_rep:str, optional


String representation of NaN to use, default ‘NaN’.  
float_format:one-parameter function, optional


Formatter function to apply to columns’ elements if they are floats, default None.  
header:bool, default True


Add the Series header (index name).  
index:bool, optional


Add index (row) labels, default True.  
length:bool, default False


Add the Series length.  
dtype:bool, default False


Add the Series dtype.  
name:bool, default False


Add the Series name if not None.  
max_rows:int, optional


Maximum number of rows to show before truncating. If None, show all.  
min_rows:int, optional


The number of rows to display in a truncated repr (when number of rows is above max_rows).    Returns 
 str or None

String representation of Series if buf=None, otherwise None.
pandas.Series.to_timestamp   Series.to_timestamp(freq=None, how='start', copy=True)[source]
 
Cast to DatetimeIndex of Timestamps, at beginning of period.  Parameters 
 
freq:str, default frequency of PeriodIndex


Desired frequency.  
how:{‘s’, ‘e’, ‘start’, ‘end’}


Convention for converting period to timestamp; start of period vs. end.  
copy:bool, default True


Whether or not to return a copy.    Returns 
 Series with DatetimeIndex
pandas.Series.to_xarray   Series.to_xarray()[source]
 
Return an xarray object from the pandas object.  Returns 
 xarray.DataArray or xarray.Dataset

Data in the pandas structure converted to Dataset if the object is a DataFrame, or a DataArray if the object is a Series.      See also  DataFrame.to_hdf

Write DataFrame to an HDF5 file.  DataFrame.to_parquet

Write a DataFrame to the binary parquet format.    Notes See the xarray docs Examples 
>>> df = pd.DataFrame([('falcon', 'bird', 389.0, 2),
...                    ('parrot', 'bird', 24.0, 2),
...                    ('lion', 'mammal', 80.5, 4),
...                    ('monkey', 'mammal', np.nan, 4)],
...                   columns=['name', 'class', 'max_speed',
...                            'num_legs'])
>>> df
     name   class  max_speed  num_legs
0  falcon    bird      389.0         2
1  parrot    bird       24.0         2
2    lion  mammal       80.5         4
3  monkey  mammal        NaN         4
  
>>> df.to_xarray()
<xarray.Dataset>
Dimensions:    (index: 4)
Coordinates:
  * index      (index) int64 0 1 2 3
Data variables:
    name       (index) object 'falcon' 'parrot' 'lion' 'monkey'
    class      (index) object 'bird' 'bird' 'mammal' 'mammal'
    max_speed  (index) float64 389.0 24.0 80.5 nan
    num_legs   (index) int64 2 2 4 4
  
>>> df['max_speed'].to_xarray()
<xarray.DataArray 'max_speed' (index: 4)>
array([389. ,  24. ,  80.5,   nan])
Coordinates:
  * index    (index) int64 0 1 2 3
  
>>> dates = pd.to_datetime(['2018-01-01', '2018-01-01',
...                         '2018-01-02', '2018-01-02'])
>>> df_multiindex = pd.DataFrame({'date': dates,
...                               'animal': ['falcon', 'parrot',
...                                          'falcon', 'parrot'],
...                               'speed': [350, 18, 361, 15]})
>>> df_multiindex = df_multiindex.set_index(['date', 'animal'])
  
>>> df_multiindex
                   speed
date       animal
2018-01-01 falcon    350
           parrot     18
2018-01-02 falcon    361
           parrot     15
  
>>> df_multiindex.to_xarray()
<xarray.Dataset>
Dimensions:  (animal: 2, date: 2)
Coordinates:
  * date     (date) datetime64[ns] 2018-01-01 2018-01-02
  * animal   (animal) object 'falcon' 'parrot'
Data variables:
    speed    (date, animal) int64 350 18 361 15
pandas.Series.tolist   Series.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.