neulab/docprompting-conala huggingface dataset:
pandas.io.json.build_table_schema   pandas.io.json.build_table_schema(data, index=True, primary_key=None, version=True)[source]
 
Create a Table schema from data.  Parameters 
 
data:Series, DataFrame


index:bool, default True


Whether to include data.index in the schema.  
primary_key:bool or None, default True


Column names to designate as the primary key. The default None will set ‘primaryKey’ to the index level or levels if the index is unique.  
version:bool, default True


Whether to include a field pandas_version with the version of pandas that last revised the table schema. This version can be different from the installed pandas version.    Returns 
 
schema:dict

   Notes See Table Schema for conversion types. Timedeltas as converted to ISO8601 duration format with 9 decimal places after the seconds field for nanosecond precision. Categoricals are converted to the any dtype, and use the enum field constraint to list the allowed values. The ordered attribute is included in an ordered field. Examples 
>>> df = pd.DataFrame(
...     {'A': [1, 2, 3],
...      'B': ['a', 'b', 'c'],
...      'C': pd.date_range('2016-01-01', freq='d', periods=3),
...     }, index=pd.Index(range(3), name='idx'))
>>> build_table_schema(df)
{'fields': [{'name': 'idx', 'type': 'integer'}, {'name': 'A', 'type': 'integer'}, {'name': 'B', 'type': 'string'}, {'name': 'C', 'type': 'datetime'}], 'primaryKey': ['idx'], 'pandas_version': '1.4.0'}
pandas.io.stata.StataReader.data_label   propertyStataReader.data_label
 
Return data label of Stata file.
pandas.io.stata.StataReader.value_labels   StataReader.value_labels()[source]
 
Return a dict, associating each variable name a dict, associating each value its corresponding label.  Returns 
 dict
pandas.io.stata.StataReader.variable_labels   StataReader.variable_labels()[source]
 
Return variable labels as a dict, associating each variable name with corresponding label.  Returns 
 dict
pandas.io.stata.StataWriter.write_file   StataWriter.write_file()[source]
 
Export DataFrame object to Stata dta format.
pandas.isna   pandas.isna(obj)[source]
 
Detect missing values for an array-like object. This function takes a scalar or array-like object and indicates whether values are missing (NaN in numeric arrays, None or NaN in object arrays, NaT in datetimelike).  Parameters 
 
obj:scalar or array-like


Object to check for null or missing values.    Returns 
 bool or array-like of bool

For scalar input, returns a scalar boolean. For array input, returns an array of boolean indicating whether each corresponding element is missing.      See also  notna

Boolean inverse of pandas.isna.  Series.isna

Detect missing values in a Series.  DataFrame.isna

Detect missing values in a DataFrame.  Index.isna

Detect missing values in an Index.    Examples Scalar arguments (including strings) result in a scalar boolean. 
>>> pd.isna('dog')
False
  
>>> pd.isna(pd.NA)
True
  
>>> pd.isna(np.nan)
True
  ndarrays result in an ndarray of booleans. 
>>> array = np.array([[1, np.nan, 3], [4, 5, np.nan]])
>>> array
array([[ 1., nan,  3.],
       [ 4.,  5., nan]])
>>> pd.isna(array)
array([[False,  True, False],
       [False, False,  True]])
  For indexes, an ndarray of booleans is returned. 
>>> index = pd.DatetimeIndex(["2017-07-05", "2017-07-06", None,
...                           "2017-07-08"])
>>> index
DatetimeIndex(['2017-07-05', '2017-07-06', 'NaT', '2017-07-08'],
              dtype='datetime64[ns]', freq=None)
>>> pd.isna(index)
array([False, False,  True, False])
  For Series and DataFrame, the same type is returned, containing booleans. 
>>> df = pd.DataFrame([['ant', 'bee', 'cat'], ['dog', None, 'fly']])
>>> df
     0     1    2
0  ant   bee  cat
1  dog  None  fly
>>> pd.isna(df)
       0      1      2
0  False  False  False
1  False   True  False
  
>>> pd.isna(df[1])
0    False
1     True
Name: 1, dtype: bool
pandas.isnull   pandas.isnull(obj)[source]
 
Detect missing values for an array-like object. This function takes a scalar or array-like object and indicates whether values are missing (NaN in numeric arrays, None or NaN in object arrays, NaT in datetimelike).  Parameters 
 
obj:scalar or array-like


Object to check for null or missing values.    Returns 
 bool or array-like of bool

For scalar input, returns a scalar boolean. For array input, returns an array of boolean indicating whether each corresponding element is missing.      See also  notna

Boolean inverse of pandas.isna.  Series.isna

Detect missing values in a Series.  DataFrame.isna

Detect missing values in a DataFrame.  Index.isna

Detect missing values in an Index.    Examples Scalar arguments (including strings) result in a scalar boolean. 
>>> pd.isna('dog')
False
  
>>> pd.isna(pd.NA)
True
  
>>> pd.isna(np.nan)
True
  ndarrays result in an ndarray of booleans. 
>>> array = np.array([[1, np.nan, 3], [4, 5, np.nan]])
>>> array
array([[ 1., nan,  3.],
       [ 4.,  5., nan]])
>>> pd.isna(array)
array([[False,  True, False],
       [False, False,  True]])
  For indexes, an ndarray of booleans is returned. 
>>> index = pd.DatetimeIndex(["2017-07-05", "2017-07-06", None,
...                           "2017-07-08"])
>>> index
DatetimeIndex(['2017-07-05', '2017-07-06', 'NaT', '2017-07-08'],
              dtype='datetime64[ns]', freq=None)
>>> pd.isna(index)
array([False, False,  True, False])
  For Series and DataFrame, the same type is returned, containing booleans. 
>>> df = pd.DataFrame([['ant', 'bee', 'cat'], ['dog', None, 'fly']])
>>> df
     0     1    2
0  ant   bee  cat
1  dog  None  fly
>>> pd.isna(df)
       0      1      2
0  False  False  False
1  False   True  False
  
>>> pd.isna(df[1])
0    False
1     True
Name: 1, dtype: bool
pandas.melt   pandas.melt(frame, id_vars=None, value_vars=None, var_name=None, value_name='value', col_level=None, ignore_index=True)[source]
 
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. This function is useful to massage a DataFrame into a format where one or more columns are identifier variables (id_vars), while all other columns, considered measured variables (value_vars), are “unpivoted” to the row axis, leaving just two non-identifier columns, ‘variable’ and ‘value’.  Parameters 
 
id_vars:tuple, list, or ndarray, optional


Column(s) to use as identifier variables.  
value_vars:tuple, list, or ndarray, optional


Column(s) to unpivot. If not specified, uses all columns that are not set as id_vars.  
var_name:scalar


Name to use for the ‘variable’ column. If None it uses frame.columns.name or ‘variable’.  
value_name:scalar, default ‘value’


Name to use for the ‘value’ column.  
col_level:int or str, optional


If columns are a MultiIndex then use this level to melt.  
ignore_index:bool, default True


If True, original index is ignored. If False, the original index is retained. Index labels will be repeated as necessary.  New in version 1.1.0.     Returns 
 DataFrame

Unpivoted DataFrame.      See also  DataFrame.melt

Identical method.  pivot_table

Create a spreadsheet-style pivot table as a DataFrame.  DataFrame.pivot

Return reshaped DataFrame organized by given index / column values.  DataFrame.explode

Explode a DataFrame from list-like columns to long format.    Examples 
>>> df = pd.DataFrame({'A': {0: 'a', 1: 'b', 2: 'c'},
...                    'B': {0: 1, 1: 3, 2: 5},
...                    'C': {0: 2, 1: 4, 2: 6}})
>>> df
   A  B  C
0  a  1  2
1  b  3  4
2  c  5  6
  
>>> pd.melt(df, id_vars=['A'], value_vars=['B'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
  
>>> pd.melt(df, id_vars=['A'], value_vars=['B', 'C'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
3  a        C      2
4  b        C      4
5  c        C      6
  The names of ‘variable’ and ‘value’ columns can be customized: 
>>> pd.melt(df, id_vars=['A'], value_vars=['B'],
...         var_name='myVarname', value_name='myValname')
   A myVarname  myValname
0  a         B          1
1  b         B          3
2  c         B          5
  Original index values can be kept around: 
>>> pd.melt(df, id_vars=['A'], value_vars=['B', 'C'], ignore_index=False)
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
0  a        C      2
1  b        C      4
2  c        C      6
  If you have multi-index columns: 
>>> df.columns = [list('ABC'), list('DEF')]
>>> df
   A  B  C
   D  E  F
0  a  1  2
1  b  3  4
2  c  5  6
  
>>> pd.melt(df, col_level=0, id_vars=['A'], value_vars=['B'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
  
>>> pd.melt(df, id_vars=[('A', 'D')], value_vars=[('B', 'E')])
  (A, D) variable_0 variable_1  value
0      a          B          E      1
1      b          B          E      3
2      c          B          E      5
pandas.merge_ordered   pandas.merge_ordered(left, right, on=None, left_on=None, right_on=None, left_by=None, right_by=None, fill_method=None, suffixes=('_x', '_y'), how='outer')[source]
 
Perform a merge for ordered data with optional filling/interpolation. Designed for ordered data like time series data. Optionally perform group-wise merge (see examples).  Parameters 
 
left:DataFrame


right:DataFrame


on:label or list


Field names to join on. Must be found in both DataFrames.  
left_on:label or list, or array-like


Field names to join on in left DataFrame. Can be a vector or list of vectors of the length of the DataFrame to use a particular vector as the join key instead of columns.  
right_on:label or list, or array-like


Field names to join on in right DataFrame or vector/list of vectors per left_on docs.  
left_by:column name or list of column names


Group left DataFrame by group columns and merge piece by piece with right DataFrame.  
right_by:column name or list of column names


Group right DataFrame by group columns and merge piece by piece with left DataFrame.  
fill_method:{‘ffill’, None}, default None


Interpolation method for data.  
suffixes:list-like, default is (“_x”, “_y”)


A length-2 sequence where each element is optionally a string indicating the suffix to add to overlapping column names in left and right respectively. Pass a value of None instead of a string to indicate that the column name from left or right should be left as-is, with no suffix. At least one of the values must not be None.  Changed in version 0.25.0.   
how:{‘left’, ‘right’, ‘outer’, ‘inner’}, default ‘outer’


 left: use only keys from left frame (SQL: left outer join) right: use only keys from right frame (SQL: right outer join) outer: use union of keys from both frames (SQL: full outer join) inner: use intersection of keys from both frames (SQL: inner join).     Returns 
 DataFrame

The merged DataFrame output type will the be same as ‘left’, if it is a subclass of DataFrame.      See also  merge

Merge with a database-style join.  merge_asof

Merge on nearest keys.    Examples 
>>> df1 = pd.DataFrame(
...     {
...         "key": ["a", "c", "e", "a", "c", "e"],
...         "lvalue": [1, 2, 3, 1, 2, 3],
...         "group": ["a", "a", "a", "b", "b", "b"]
...     }
... )
>>> df1
      key  lvalue group
0   a       1     a
1   c       2     a
2   e       3     a
3   a       1     b
4   c       2     b
5   e       3     b
  
>>> df2 = pd.DataFrame({"key": ["b", "c", "d"], "rvalue": [1, 2, 3]})
>>> df2
      key  rvalue
0   b       1
1   c       2
2   d       3
  
>>> merge_ordered(df1, df2, fill_method="ffill", left_by="group")
  key  lvalue group  rvalue
0   a       1     a     NaN
1   b       1     a     1.0
2   c       2     a     2.0
3   d       2     a     3.0
4   e       3     a     3.0
5   a       1     b     NaN
6   b       1     b     1.0
7   c       2     b     2.0
8   d       2     b     3.0
9   e       3     b     3.0
pandas.MultiIndex   classpandas.MultiIndex(levels=None, codes=None, sortorder=None, names=None, dtype=None, copy=False, name=None, verify_integrity=True)[source]
 
A multi-level, or hierarchical, index object for pandas objects.  Parameters 
 
levels:sequence of arrays


The unique labels for each level.  
codes:sequence of arrays


Integers for each level designating which label at each location.  
sortorder:optional int


Level of sortedness (must be lexicographically sorted by that level).  
names:optional sequence of objects


Names for each of the index levels. (name is accepted for compat).  
copy:bool, default False


Copy the meta-data.  
verify_integrity:bool, default True


Check that the levels/codes are consistent and valid.      See also  MultiIndex.from_arrays

Convert list of arrays to MultiIndex.  MultiIndex.from_product

Create a MultiIndex from the cartesian product of iterables.  MultiIndex.from_tuples

Convert list of tuples to a MultiIndex.  MultiIndex.from_frame

Make a MultiIndex from a DataFrame.  Index

The base pandas Index type.    Notes See the user guide for more. Examples A new MultiIndex is typically constructed using one of the helper methods MultiIndex.from_arrays(), MultiIndex.from_product() and MultiIndex.from_tuples(). For example (using .from_arrays): 
>>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
>>> pd.MultiIndex.from_arrays(arrays, names=('number', 'color'))
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           names=['number', 'color'])
  See further examples for how to construct a MultiIndex in the doc strings of the mentioned helper methods. Attributes       
names Names of levels in MultiIndex.  
nlevels Integer number of levels in this MultiIndex.  
levshape A tuple with the length of each level.          
levels   
codes     Methods       
from_arrays(arrays[, sortorder, names]) Convert arrays to MultiIndex.  
from_tuples(tuples[, sortorder, names]) Convert list of tuples to MultiIndex.  
from_product(iterables[, sortorder, names]) Make a MultiIndex from the cartesian product of multiple iterables.  
from_frame(df[, sortorder, names]) Make a MultiIndex from a DataFrame.  
set_levels(levels[, level, inplace, ...]) Set new levels on MultiIndex.  
set_codes(codes[, level, inplace, ...]) Set new codes on MultiIndex.  
to_frame([index, name]) Create a DataFrame with the levels of the MultiIndex as columns.  
to_flat_index() Convert a MultiIndex to an Index of Tuples containing the level values.  
sortlevel([level, ascending, sort_remaining]) Sort MultiIndex at the requested level.  
droplevel([level]) Return index with requested level(s) removed.  
swaplevel([i, j]) Swap level i with level j.  
reorder_levels(order) Rearrange levels using input order.  
remove_unused_levels() Create new MultiIndex from current that removes unused levels.  
get_locs(seq) Get location for a sequence of labels.
pandas.MultiIndex.droplevel   MultiIndex.droplevel(level=0)[source]
 
Return index with requested level(s) removed. If resulting index has only 1 level left, the result will be of Index type, not MultiIndex.  Parameters 
 
level:int, str, or list-like, default 0


If a string is given, must be the name of a level If list-like, elements must be names or indexes of levels.    Returns 
 Index or MultiIndex
   Examples 
>>> mi = pd.MultiIndex.from_arrays(
... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z'])
>>> mi
MultiIndex([(1, 3, 5),
            (2, 4, 6)],
           names=['x', 'y', 'z'])
  
>>> mi.droplevel()
MultiIndex([(3, 5),
            (4, 6)],
           names=['y', 'z'])
  
>>> mi.droplevel(2)
MultiIndex([(1, 3),
            (2, 4)],
           names=['x', 'y'])
  
>>> mi.droplevel('z')
MultiIndex([(1, 3),
            (2, 4)],
           names=['x', 'y'])
  
>>> mi.droplevel(['x', 'y'])
Int64Index([5, 6], dtype='int64', name='z')
pandas.MultiIndex.dtypes   MultiIndex.dtypes
 
Return the dtypes as a Series for the underlying MultiIndex.
pandas.MultiIndex.from_arrays   classmethodMultiIndex.from_arrays(arrays, sortorder=None, names=NoDefault.no_default)[source]
 
Convert arrays to MultiIndex.  Parameters 
 
arrays:list / sequence of array-likes


Each array-like gives one level’s value for each data point. len(arrays) is the number of levels.  
sortorder:int or None


Level of sortedness (must be lexicographically sorted by that level).  
names:list / sequence of str, optional


Names for the levels in the index.    Returns 
 MultiIndex
    See also  MultiIndex.from_tuples

Convert list of tuples to MultiIndex.  MultiIndex.from_product

Make a MultiIndex from cartesian product of iterables.  MultiIndex.from_frame

Make a MultiIndex from a DataFrame.    Examples 
>>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
>>> pd.MultiIndex.from_arrays(arrays, names=('number', 'color'))
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           names=['number', 'color'])
pandas.MultiIndex.from_frame   classmethodMultiIndex.from_frame(df, sortorder=None, names=None)[source]
 
Make a MultiIndex from a DataFrame.  Parameters 
 
df:DataFrame


DataFrame to be converted to MultiIndex.  
sortorder:int, optional


Level of sortedness (must be lexicographically sorted by that level).  
names:list-like, optional


If no names are provided, use the column names, or tuple of column names if the columns is a MultiIndex. If a sequence, overwrite names with the given sequence.    Returns 
 MultiIndex

The MultiIndex representation of the given DataFrame.      See also  MultiIndex.from_arrays

Convert list of arrays to MultiIndex.  MultiIndex.from_tuples

Convert list of tuples to MultiIndex.  MultiIndex.from_product

Make a MultiIndex from cartesian product of iterables.    Examples 
>>> df = pd.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
...                    ['NJ', 'Temp'], ['NJ', 'Precip']],
...                   columns=['a', 'b'])
>>> df
      a       b
0    HI    Temp
1    HI  Precip
2    NJ    Temp
3    NJ  Precip
  
>>> pd.MultiIndex.from_frame(df)
MultiIndex([('HI',   'Temp'),
            ('HI', 'Precip'),
            ('NJ',   'Temp'),
            ('NJ', 'Precip')],
           names=['a', 'b'])
  Using explicit names, instead of the column names 
>>> pd.MultiIndex.from_frame(df, names=['state', 'observation'])
MultiIndex([('HI',   'Temp'),
            ('HI', 'Precip'),
            ('NJ',   'Temp'),
            ('NJ', 'Precip')],
           names=['state', 'observation'])
pandas.MultiIndex.from_product   classmethodMultiIndex.from_product(iterables, sortorder=None, names=NoDefault.no_default)[source]
 
Make a MultiIndex from the cartesian product of multiple iterables.  Parameters 
 
iterables:list / sequence of iterables


Each iterable has unique labels for each level of the index.  
sortorder:int or None


Level of sortedness (must be lexicographically sorted by that level).  
names:list / sequence of str, optional


Names for the levels in the index.  Changed in version 1.0.0: If not explicitly provided, names will be inferred from the elements of iterables if an element has a name attribute     Returns 
 MultiIndex
    See also  MultiIndex.from_arrays

Convert list of arrays to MultiIndex.  MultiIndex.from_tuples

Convert list of tuples to MultiIndex.  MultiIndex.from_frame

Make a MultiIndex from a DataFrame.    Examples 
>>> numbers = [0, 1, 2]
>>> colors = ['green', 'purple']
>>> pd.MultiIndex.from_product([numbers, colors],
...                            names=['number', 'color'])
MultiIndex([(0,  'green'),
            (0, 'purple'),
            (1,  'green'),
            (1, 'purple'),
            (2,  'green'),
            (2, 'purple')],
           names=['number', 'color'])
pandas.MultiIndex.from_tuples   classmethodMultiIndex.from_tuples(tuples, sortorder=None, names=None)[source]
 
Convert list of tuples to MultiIndex.  Parameters 
 
tuples:list / sequence of tuple-likes


Each tuple is the index of one row/column.  
sortorder:int or None


Level of sortedness (must be lexicographically sorted by that level).  
names:list / sequence of str, optional


Names for the levels in the index.    Returns 
 MultiIndex
    See also  MultiIndex.from_arrays

Convert list of arrays to MultiIndex.  MultiIndex.from_product

Make a MultiIndex from cartesian product of iterables.  MultiIndex.from_frame

Make a MultiIndex from a DataFrame.    Examples 
>>> tuples = [(1, 'red'), (1, 'blue'),
...           (2, 'red'), (2, 'blue')]
>>> pd.MultiIndex.from_tuples(tuples, names=('number', 'color'))
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           names=['number', 'color'])
pandas.MultiIndex.get_indexer   MultiIndex.get_indexer(target, method=None, limit=None, tolerance=None)[source]
 
Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index.  Parameters 
 
target:Index


method:{None, ‘pad’/’ffill’, ‘backfill’/’bfill’, ‘nearest’}, optional


 default: exact matches only. pad / ffill: find the PREVIOUS index value if no exact match. backfill / bfill: use NEXT index value if no exact match nearest: use the NEAREST index value if no exact match. Tied distances are broken by preferring the larger index value.   
limit:int, optional


Maximum number of consecutive labels in target to match for inexact matches.  
tolerance:optional


Maximum distance between original and new labels for inexact matches. The values of the index at the matching locations must satisfy the equation abs(index[indexer] - target) <= tolerance. Tolerance may be a scalar value, which applies the same tolerance to all values, or list-like, which applies variable tolerance per element. List-like includes list, tuple, array, Series, and must be the same size as the index and its dtype must exactly match the index’s type.    Returns 
 
indexer:np.ndarray[np.intp]


Integers from 0 to n - 1 indicating that the index at these positions matches the corresponding target values. Missing values in the target are marked by -1.     Notes Returns -1 for unmatched values, for further explanation see the example below. Examples 
>>> index = pd.Index(['c', 'a', 'b'])
>>> index.get_indexer(['a', 'b', 'x'])
array([ 1,  2, -1])
  Notice that the return value is an array of locations in index and x is marked by -1, as it is not in index.
pandas.MultiIndex.get_level_values   MultiIndex.get_level_values(level)[source]
 
Return vector of label values for requested level. Length of returned vector is equal to the length of the index.  Parameters 
 
level:int or str


level is either the integer position of the level in the MultiIndex, or the name of the level.    Returns 
 
values:Index


Values is a level of this MultiIndex converted to a single Index (or subclass thereof).     Notes If the level contains missing values, the result may be casted to float with missing values specified as NaN. This is because the level is converted to a regular Index. Examples Create a MultiIndex: 
>>> mi = pd.MultiIndex.from_arrays((list('abc'), list('def')))
>>> mi.names = ['level_1', 'level_2']
  Get level values by supplying level as either integer or name: 
>>> mi.get_level_values(0)
Index(['a', 'b', 'c'], dtype='object', name='level_1')
>>> mi.get_level_values('level_2')
Index(['d', 'e', 'f'], dtype='object', name='level_2')
  If a level contains missing values, the return type of the level maybe casted to float. 
>>> pd.MultiIndex.from_arrays([[1, None, 2], [3, 4, 5]]).dtypes
level_0    int64
level_1    int64
dtype: object
>>> pd.MultiIndex.from_arrays([[1, None, 2], [3, 4, 5]]).get_level_values(0)
Float64Index([1.0, nan, 2.0], dtype='float64')