neulab/docprompting-conala huggingface dataset:
pandas.read_sql_table   pandas.read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize=None)[source]
 
Read SQL database table into a DataFrame. Given a table name and a SQLAlchemy connectable, returns a DataFrame. This function does not support DBAPI connections.  Parameters 
 
table_name:str


Name of SQL table in database.  
con:SQLAlchemy connectable or str


A database URI could be provided as str. SQLite DBAPI connection mode not supported.  
schema:str, default None


Name of SQL schema in database to query (if database flavor supports this). Uses default schema if None (default).  
index_col:str or list of str, optional, default: None


Column(s) to set as index(MultiIndex).  
coerce_float:bool, default True


Attempts to convert values of non-string, non-numeric objects (like decimal.Decimal) to floating point. Can result in loss of Precision.  
parse_dates:list or dict, default None


 List of column names to parse as dates. Dict of {column_name: format string} where format string is strftime compatible in case of parsing string times or is one of (D, s, ns, ms, us) in case of parsing integer timestamps. Dict of {column_name: arg dict}, where the arg dict corresponds to the keyword arguments of pandas.to_datetime() Especially useful with databases without native Datetime support, such as SQLite.   
columns:list, default None


List of column names to select from SQL table.  
chunksize:int, default None


If specified, returns an iterator where chunksize is the number of rows to include in each chunk.    Returns 
 DataFrame or Iterator[DataFrame]

A SQL table is returned as two-dimensional data structure with labeled axes.      See also  read_sql_query

Read SQL query into a DataFrame.  read_sql

Read SQL query or database table into a DataFrame.    Notes Any datetime values with time zone information will be converted to UTC. Examples 
>>> pd.read_sql_table('table_name', 'postgres:///db_name')
pandas.Series.__array__   Series.__array__(dtype=None)[source]
 
Return the values as a NumPy array. Users should not call this directly. Rather, it is invoked by numpy.array() and numpy.asarray().  Parameters 
 
dtype:str or numpy.dtype, optional


The dtype to use for the resulting NumPy array. By default, the dtype is inferred from the data.    Returns 
 numpy.ndarray

The values in the series converted to a numpy.ndarray with the specified dtype.      See also  array

Create a new array from data.  Series.array

Zero-copy view to the array backing the Series.  Series.to_numpy

Series method for similar behavior.    Examples 
>>> ser = pd.Series([1, 2, 3])
>>> np.asarray(ser)
array([1, 2, 3])
  For timezone-aware data, the timezones may be retained with dtype='object' 
>>> tzser = pd.Series(pd.date_range('2000', periods=2, tz="CET"))
>>> np.asarray(tzser, 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 the values may be localized to UTC and the tzinfo discarded with dtype='datetime64[ns]' 
>>> np.asarray(tzser, dtype="datetime64[ns]")  
array(['1999-12-31T23:00:00.000000000', ...],
      dtype='datetime64[ns]')
pandas.Series.__iter__   Series.__iter__()[source]
 
Return an iterator 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 
 iterator
pandas.Series.abs   Series.abs()[source]
 
Return a Series/DataFrame with absolute numeric value of each element. This function only applies to elements that are all numeric.  Returns 
 abs

Series/DataFrame containing the absolute value of each element.      See also  numpy.absolute

Calculate the absolute value element-wise.    Notes For complex inputs, 1.2 + 1j, the absolute value is \(\sqrt{ a^2 + b^2 }\). Examples Absolute numeric values in a Series. 
>>> s = pd.Series([-1.10, 2, -3.33, 4])
>>> s.abs()
0    1.10
1    2.00
2    3.33
3    4.00
dtype: float64
  Absolute numeric values in a Series with complex numbers. 
>>> s = pd.Series([1.2 + 1j])
>>> s.abs()
0    1.56205
dtype: float64
  Absolute numeric values in a Series with a Timedelta element. 
>>> s = pd.Series([pd.Timedelta('1 days')])
>>> s.abs()
0   1 days
dtype: timedelta64[ns]
  Select rows with data closest to certain value using argsort (from StackOverflow). 
>>> df = pd.DataFrame({
...     'a': [4, 5, 6, 7],
...     'b': [10, 20, 30, 40],
...     'c': [100, 50, -30, -50]
... })
>>> df
     a    b    c
0    4   10  100
1    5   20   50
2    6   30  -30
3    7   40  -50
>>> df.loc[(df.c - 43).abs().argsort()]
     a    b    c
1    5   20   50
0    4   10  100
2    6   30  -30
3    7   40  -50
pandas.Series.add   Series.add(other, level=None, fill_value=None, axis=0)[source]
 
Return Addition of series and other, element-wise (binary operator add). 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.radd

Reverse of the Addition 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.add(b, fill_value=0)
a    2.0
b    1.0
c    1.0
d    1.0
e    NaN
dtype: float64
pandas.Series.add_prefix   Series.add_prefix(prefix)[source]
 
Prefix labels with string prefix. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed.  Parameters 
 
prefix:str


The string to add before each label.    Returns 
 Series or DataFrame

New Series or DataFrame with updated labels.      See also  Series.add_suffix

Suffix row labels with string suffix.  DataFrame.add_suffix

Suffix column labels with string suffix.    Examples 
>>> s = pd.Series([1, 2, 3, 4])
>>> s
0    1
1    2
2    3
3    4
dtype: int64
  
>>> s.add_prefix('item_')
item_0    1
item_1    2
item_2    3
item_3    4
dtype: int64
  
>>> df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [3, 4, 5, 6]})
>>> df
   A  B
0  1  3
1  2  4
2  3  5
3  4  6
  
>>> df.add_prefix('col_')
     col_A  col_B
0       1       3
1       2       4
2       3       5
3       4       6
pandas.Series.add_suffix   Series.add_suffix(suffix)[source]
 
Suffix labels with string suffix. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed.  Parameters 
 
suffix:str


The string to add after each label.    Returns 
 Series or DataFrame

New Series or DataFrame with updated labels.      See also  Series.add_prefix

Prefix row labels with string prefix.  DataFrame.add_prefix

Prefix column labels with string prefix.    Examples 
>>> s = pd.Series([1, 2, 3, 4])
>>> s
0    1
1    2
2    3
3    4
dtype: int64
  
>>> s.add_suffix('_item')
0_item    1
1_item    2
2_item    3
3_item    4
dtype: int64
  
>>> df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [3, 4, 5, 6]})
>>> df
   A  B
0  1  3
1  2  4
2  3  5
3  4  6
  
>>> df.add_suffix('_col')
     A_col  B_col
0       1       3
1       2       4
2       3       5
3       4       6
pandas.Series.agg   Series.agg(func=None, axis=0, *args, **kwargs)[source]
 
Aggregate using one or more operations over the specified axis.  Parameters 
 
func:function, str, list or dict


Function to use for aggregating the data. If a function, must either work when passed a Series or when passed to Series.apply. Accepted combinations are:  function string function name list of functions and/or function names, e.g. [np.sum, 'mean'] dict of axis labels -> functions, function names or list of such.   
axis:{0 or ‘index’}


Parameter needed for compatibility with DataFrame.  *args

Positional arguments to pass to func.  **kwargs

Keyword arguments to pass to func.    Returns 
 scalar, Series or DataFrame

The return can be:  scalar : when Series.agg is called with single function Series : when DataFrame.agg is called with a single function DataFrame : when DataFrame.agg is called with several functions  Return scalar, Series or DataFrame.      See also  Series.apply

Invoke function on a Series.  Series.transform

Transform function producing a Series with like indexes.    Notes agg is an alias for aggregate. Use the alias. Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. A passed user-defined-function will be passed a Series for evaluation. Examples 
>>> s = pd.Series([1, 2, 3, 4])
>>> s
0    1
1    2
2    3
3    4
dtype: int64
  
>>> s.agg('min')
1
  
>>> s.agg(['min', 'max'])
min   1
max   4
dtype: int64
pandas.Series.aggregate   Series.aggregate(func=None, axis=0, *args, **kwargs)[source]
 
Aggregate using one or more operations over the specified axis.  Parameters 
 
func:function, str, list or dict


Function to use for aggregating the data. If a function, must either work when passed a Series or when passed to Series.apply. Accepted combinations are:  function string function name list of functions and/or function names, e.g. [np.sum, 'mean'] dict of axis labels -> functions, function names or list of such.   
axis:{0 or ‘index’}


Parameter needed for compatibility with DataFrame.  *args

Positional arguments to pass to func.  **kwargs

Keyword arguments to pass to func.    Returns 
 scalar, Series or DataFrame

The return can be:  scalar : when Series.agg is called with single function Series : when DataFrame.agg is called with a single function DataFrame : when DataFrame.agg is called with several functions  Return scalar, Series or DataFrame.      See also  Series.apply

Invoke function on a Series.  Series.transform

Transform function producing a Series with like indexes.    Notes agg is an alias for aggregate. Use the alias. Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. A passed user-defined-function will be passed a Series for evaluation. Examples 
>>> s = pd.Series([1, 2, 3, 4])
>>> s
0    1
1    2
2    3
3    4
dtype: int64
  
>>> s.agg('min')
1
  
>>> s.agg(['min', 'max'])
min   1
max   4
dtype: int64
pandas.Series.all   Series.all(axis=0, bool_only=None, skipna=True, level=None, **kwargs)[source]
 
Return whether all elements are True, potentially over an axis. Returns True unless there at least one element within a series or along a Dataframe axis that is False or equivalent (e.g. zero or empty).  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’, None}, default 0


Indicate which axis or axes should be reduced.  0 / ‘index’ : reduce the index, return a Series whose index is the original column labels. 1 / ‘columns’ : reduce the columns, return a Series whose index is the original index. None : reduce all axes, return a scalar.   
bool_only:bool, default None


Include only boolean columns. If None, will attempt to use everything, then use only boolean data. Not implemented for Series.  
skipna:bool, default True


Exclude NA/null values. If the entire row/column is NA and skipna is True, then the result will be True, as for an empty row/column. If skipna is False, then NA are treated as True, because these are not equal to zero.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.  
**kwargs:any, default None


Additional keywords have no effect but might be accepted for compatibility with NumPy.    Returns 
 scalar or Series

If level is specified, then, Series is returned; otherwise, scalar is returned.      See also  Series.all

Return True if all elements are True.  DataFrame.any

Return True if one (or more) elements are True.    Examples Series 
>>> pd.Series([True, True]).all()
True
>>> pd.Series([True, False]).all()
False
>>> pd.Series([], dtype="float64").all()
True
>>> pd.Series([np.nan]).all()
True
>>> pd.Series([np.nan]).all(skipna=False)
True
  DataFrames Create a dataframe from a dictionary. 
>>> df = pd.DataFrame({'col1': [True, True], 'col2': [True, False]})
>>> df
   col1   col2
0  True   True
1  True  False
  Default behaviour checks if column-wise values all return True. 
>>> df.all()
col1     True
col2    False
dtype: bool
  Specify axis='columns' to check if row-wise values all return True. 
>>> df.all(axis='columns')
0     True
1    False
dtype: bool
  Or axis=None for whether every value is True. 
>>> df.all(axis=None)
False
pandas.Series.any   Series.any(axis=0, bool_only=None, skipna=True, level=None, **kwargs)[source]
 
Return whether any element is True, potentially over an axis. Returns False unless there is at least one element within a series or along a Dataframe axis that is True or equivalent (e.g. non-zero or non-empty).  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’, None}, default 0


Indicate which axis or axes should be reduced.  0 / ‘index’ : reduce the index, return a Series whose index is the original column labels. 1 / ‘columns’ : reduce the columns, return a Series whose index is the original index. None : reduce all axes, return a scalar.   
bool_only:bool, default None


Include only boolean columns. If None, will attempt to use everything, then use only boolean data. Not implemented for Series.  
skipna:bool, default True


Exclude NA/null values. If the entire row/column is NA and skipna is True, then the result will be False, as for an empty row/column. If skipna is False, then NA are treated as True, because these are not equal to zero.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.  
**kwargs:any, default None


Additional keywords have no effect but might be accepted for compatibility with NumPy.    Returns 
 scalar or Series

If level is specified, then, Series is returned; otherwise, scalar is returned.      See also  numpy.any

Numpy version of this method.  Series.any

Return whether any element is True.  Series.all

Return whether all elements are True.  DataFrame.any

Return whether any element is True over requested axis.  DataFrame.all

Return whether all elements are True over requested axis.    Examples Series For Series input, the output is a scalar indicating whether any element is True. 
>>> pd.Series([False, False]).any()
False
>>> pd.Series([True, False]).any()
True
>>> pd.Series([], dtype="float64").any()
False
>>> pd.Series([np.nan]).any()
False
>>> pd.Series([np.nan]).any(skipna=False)
True
  DataFrame Whether each column contains at least one True element (the default). 
>>> df = pd.DataFrame({"A": [1, 2], "B": [0, 2], "C": [0, 0]})
>>> df
   A  B  C
0  1  0  0
1  2  2  0
  
>>> df.any()
A     True
B     True
C    False
dtype: bool
  Aggregating over the columns. 
>>> df = pd.DataFrame({"A": [True, False], "B": [1, 2]})
>>> df
       A  B
0   True  1
1  False  2
  
>>> df.any(axis='columns')
0    True
1    True
dtype: bool
  
>>> df = pd.DataFrame({"A": [True, False], "B": [1, 0]})
>>> df
       A  B
0   True  1
1  False  0
  
>>> df.any(axis='columns')
0    True
1    False
dtype: bool
  Aggregating over the entire DataFrame with axis=None. 
>>> df.any(axis=None)
True
  any for an empty DataFrame is an empty Series. 
>>> pd.DataFrame([]).any()
Series([], dtype: bool)
pandas.Series.append   Series.append(to_append, ignore_index=False, verify_integrity=False)[source]
 
Concatenate two or more Series.  Parameters 
 
to_append:Series or list/tuple of Series


Series to append with self.  
ignore_index:bool, default False


If True, the resulting axis will be labeled 0, 1, …, n - 1.  
verify_integrity:bool, default False


If True, raise Exception on creating index with duplicates.    Returns 
 Series

Concatenated Series.      See also  concat

General function to concatenate DataFrame or Series objects.    Notes Iteratively appending to a Series can be more computationally intensive than a single concatenate. A better solution is to append values to a list and then concatenate the list with the original Series all at once. Examples 
>>> s1 = pd.Series([1, 2, 3])
>>> s2 = pd.Series([4, 5, 6])
>>> s3 = pd.Series([4, 5, 6], index=[3, 4, 5])
>>> s1.append(s2)
0    1
1    2
2    3
0    4
1    5
2    6
dtype: int64
  
>>> s1.append(s3)
0    1
1    2
2    3
3    4
4    5
5    6
dtype: int64
  With ignore_index set to True: 
>>> s1.append(s2, ignore_index=True)
0    1
1    2
2    3
3    4
4    5
5    6
dtype: int64
  With verify_integrity set to True: 
>>> s1.append(s2, verify_integrity=True)
Traceback (most recent call last):
...
ValueError: Indexes have overlapping values: [0, 1, 2]
pandas.Series.apply   Series.apply(func, convert_dtype=True, args=(), **kwargs)[source]
 
Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) or a Python function that only works on single values.  Parameters 
 
func:function


Python function or NumPy ufunc to apply.  
convert_dtype:bool, default True


Try to find better dtype for elementwise function results. If False, leave as dtype=object. Note that the dtype is always preserved for some extension array dtypes, such as Categorical.  
args:tuple


Positional arguments passed to func after the series value.  **kwargs

Additional keyword arguments passed to func.    Returns 
 Series or DataFrame

If func returns a Series object the result will be a DataFrame.      See also  Series.map

For element-wise operations.  Series.agg

Only perform aggregating type operations.  Series.transform

Only perform transforming type operations.    Notes Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. Examples Create a series with typical summer temperatures for each city. 
>>> s = pd.Series([20, 21, 12],
...               index=['London', 'New York', 'Helsinki'])
>>> s
London      20
New York    21
Helsinki    12
dtype: int64
  Square the values by defining a function and passing it as an argument to apply(). 
>>> def square(x):
...     return x ** 2
>>> s.apply(square)
London      400
New York    441
Helsinki    144
dtype: int64
  Square the values by passing an anonymous function as an argument to apply(). 
>>> s.apply(lambda x: x ** 2)
London      400
New York    441
Helsinki    144
dtype: int64
  Define a custom function that needs additional positional arguments and pass these additional arguments using the args keyword. 
>>> def subtract_custom_value(x, custom_value):
...     return x - custom_value
  
>>> s.apply(subtract_custom_value, args=(5,))
London      15
New York    16
Helsinki     7
dtype: int64
  Define a custom function that takes keyword arguments and pass these arguments to apply. 
>>> def add_custom_values(x, **kwargs):
...     for month in kwargs:
...         x += kwargs[month]
...     return x
  
>>> s.apply(add_custom_values, june=30, july=20, august=25)
London      95
New York    96
Helsinki    87
dtype: int64
  Use a function from the Numpy library. 
>>> s.apply(np.log)
London      2.995732
New York    3.044522
Helsinki    2.484907
dtype: float64
pandas.Series.argmax   Series.argmax(axis=None, skipna=True, *args, **kwargs)[source]
 
Return int position of the largest value in the Series. If the maximum is achieved in multiple locations, the first row position is returned.  Parameters 
 
axis:{None}


Dummy argument for consistency with Series.  
skipna:bool, default True


Exclude NA/null values when showing the result.  *args, **kwargs

Additional arguments and keywords for compatibility with NumPy.    Returns 
 int

Row position of the maximum value.      See also  Series.argmax

Return position of the maximum value.  Series.argmin

Return position of the minimum value.  numpy.ndarray.argmax

Equivalent method for numpy arrays.  Series.idxmax

Return index label of the maximum values.  Series.idxmin

Return index label of the minimum values.    Examples Consider dataset containing cereal calories 
>>> s = pd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
...                'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
>>> s
Corn Flakes              100.0
Almond Delight           110.0
Cinnamon Toast Crunch    120.0
Cocoa Puff               110.0
dtype: float64
  
>>> s.argmax()
2
>>> s.argmin()
0
  The maximum cereal calories is the third element and the minimum cereal calories is the first element, since series is zero-indexed.
pandas.Series.argmin   Series.argmin(axis=None, skipna=True, *args, **kwargs)[source]
 
Return int position of the smallest value in the Series. If the minimum is achieved in multiple locations, the first row position is returned.  Parameters 
 
axis:{None}


Dummy argument for consistency with Series.  
skipna:bool, default True


Exclude NA/null values when showing the result.  *args, **kwargs

Additional arguments and keywords for compatibility with NumPy.    Returns 
 int

Row position of the minimum value.      See also  Series.argmin

Return position of the minimum value.  Series.argmax

Return position of the maximum value.  numpy.ndarray.argmin

Equivalent method for numpy arrays.  Series.idxmax

Return index label of the maximum values.  Series.idxmin

Return index label of the minimum values.    Examples Consider dataset containing cereal calories 
>>> s = pd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
...                'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
>>> s
Corn Flakes              100.0
Almond Delight           110.0
Cinnamon Toast Crunch    120.0
Cocoa Puff               110.0
dtype: float64
  
>>> s.argmax()
2
>>> s.argmin()
0
  The maximum cereal calories is the third element and the minimum cereal calories is the first element, since series is zero-indexed.
pandas.Series.argsort   Series.argsort(axis=0, kind='quicksort', order=None)[source]
 
Return the integer indices that would sort the Series values. Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values.  Parameters 
 
axis:{0 or “index”}


Has no effect but is accepted for compatibility with numpy.  
kind:{‘mergesort’, ‘quicksort’, ‘heapsort’, ‘stable’}, default ‘quicksort’


Choice of sorting algorithm. See numpy.sort() for more information. ‘mergesort’ and ‘stable’ are the only stable algorithms.  
order:None


Has no effect but is accepted for compatibility with numpy.    Returns 
 Series[np.intp]

Positions of values within the sort order with -1 indicating nan values.      See also  numpy.ndarray.argsort

Returns the indices that would sort this array.