neulab/docprompting-conala huggingface dataset:
pandas.DataFrame.memory_usage   DataFrame.memory_usage(index=True, deep=False)[source]
 
Return the memory usage of each column in bytes. The memory usage can optionally include the contribution of the index and elements of object dtype. This value is displayed in DataFrame.info by default. This can be suppressed by setting pandas.options.display.memory_usage to False.  Parameters 
 
index:bool, default True


Specifies whether to include the memory usage of the DataFrame’s index in returned Series. If index=True, the memory usage of the index is the first item in the output.  
deep:bool, default False


If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned values.    Returns 
 Series

A Series whose index is the original column names and whose values is the memory usage of each column in bytes.      See also  numpy.ndarray.nbytes

Total bytes consumed by the elements of an ndarray.  Series.memory_usage

Bytes consumed by a Series.  Categorical

Memory-efficient array for string values with many repeated values.  DataFrame.info

Concise summary of a DataFrame.    Examples 
>>> dtypes = ['int64', 'float64', 'complex128', 'object', 'bool']
>>> data = dict([(t, np.ones(shape=5000, dtype=int).astype(t))
...              for t in dtypes])
>>> df = pd.DataFrame(data)
>>> df.head()
   int64  float64            complex128  object  bool
0      1      1.0              1.0+0.0j       1  True
1      1      1.0              1.0+0.0j       1  True
2      1      1.0              1.0+0.0j       1  True
3      1      1.0              1.0+0.0j       1  True
4      1      1.0              1.0+0.0j       1  True
  
>>> df.memory_usage()
Index           128
int64         40000
float64       40000
complex128    80000
object        40000
bool           5000
dtype: int64
  
>>> df.memory_usage(index=False)
int64         40000
float64       40000
complex128    80000
object        40000
bool           5000
dtype: int64
  The memory footprint of object dtype columns is ignored by default: 
>>> df.memory_usage(deep=True)
Index            128
int64          40000
float64        40000
complex128     80000
object        180000
bool            5000
dtype: int64
  Use a Categorical for efficient storage of an object-dtype column with many repeated values. 
>>> df['object'].astype('category').memory_usage(deep=True)
5244
pandas.DataFrame.min   DataFrame.min(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return the minimum of the values over the requested axis. If you want the index of the minimum, use idxmin. This is the equivalent of the numpy.ndarray method argmin.  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)
    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.min()
0
pandas.DataFrame.mode   DataFrame.mode(axis=0, numeric_only=False, dropna=True)[source]
 
Get the mode(s) of each element along the selected axis. The mode of a set of values is the value that appears most often. It can be multiple values.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to iterate over while searching for the mode:  0 or ‘index’ : get mode of each column 1 or ‘columns’ : get mode of each row.   
numeric_only:bool, default False


If True, only apply to numeric columns.  
dropna:bool, default True


Don’t consider counts of NaN/NaT.    Returns 
 DataFrame

The modes of each column or row.      See also  Series.mode

Return the highest frequency value in a Series.  Series.value_counts

Return the counts of values in a Series.    Examples 
>>> df = pd.DataFrame([('bird', 2, 2),
...                    ('mammal', 4, np.nan),
...                    ('arthropod', 8, 0),
...                    ('bird', 2, np.nan)],
...                   index=('falcon', 'horse', 'spider', 'ostrich'),
...                   columns=('species', 'legs', 'wings'))
>>> df
           species  legs  wings
falcon        bird     2    2.0
horse       mammal     4    NaN
spider   arthropod     8    0.0
ostrich       bird     2    NaN
  By default, missing values are not considered, and the mode of wings are both 0 and 2. Because the resulting DataFrame has two rows, the second row of species and legs contains NaN. 
>>> df.mode()
  species  legs  wings
0    bird   2.0    0.0
1     NaN   NaN    2.0
  Setting dropna=False NaN values are considered and they can be the mode (like for wings). 
>>> df.mode(dropna=False)
  species  legs  wings
0    bird     2    NaN
  Setting numeric_only=True, only the mode of numeric columns is computed, and columns of other types are ignored. 
>>> df.mode(numeric_only=True)
   legs  wings
0   2.0    0.0
1   NaN    2.0
  To compute the mode over columns and not rows, use the axis parameter: 
>>> df.mode(axis='columns', numeric_only=True)
           0    1
falcon   2.0  NaN
horse    4.0  NaN
spider   0.0  8.0
ostrich  2.0  NaN
pandas.DataFrame.ndim   propertyDataFrame.ndim
 
Return an int representing the number of axes / array dimensions. Return 1 if Series. Otherwise return 2 if DataFrame.  See also  ndarray.ndim

Number of array dimensions.    Examples 
>>> s = pd.Series({'a': 1, 'b': 2, 'c': 3})
>>> s.ndim
1
  
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.ndim
2
pandas.DataFrame.notna   DataFrame.notna()[source]
 
Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.  Returns 
 DataFrame

Mask of bool values for each element in DataFrame that indicates whether an element is not an NA value.      See also  DataFrame.notnull

Alias of notna.  DataFrame.isna

Boolean inverse of notna.  DataFrame.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA. 
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker
  
>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.notna()
0     True
1     True
2    False
dtype: bool
pandas.DataFrame.notnull   DataFrame.notnull()[source]
 
DataFrame.notnull is an alias for DataFrame.notna. Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.  Returns 
 DataFrame

Mask of bool values for each element in DataFrame that indicates whether an element is not an NA value.      See also  DataFrame.notnull

Alias of notna.  DataFrame.isna

Boolean inverse of notna.  DataFrame.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA. 
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker
  
>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.notna()
0     True
1     True
2    False
dtype: bool
pandas.DataFrame.nsmallest   DataFrame.nsmallest(n, columns, keep='first')[source]
 
Return the first n rows ordered by columns in ascending order. Return the first n rows with the smallest values in columns, in ascending order. The columns that are not specified are returned as well, but not used for ordering. This method is equivalent to df.sort_values(columns, ascending=True).head(n), but more performant.  Parameters 
 
n:int


Number of items to retrieve.  
columns:list or str


Column name or names to order by.  
keep:{‘first’, ‘last’, ‘all’}, default ‘first’


Where there are duplicate values:  first : take the first occurrence. last : take the last occurrence. all : do not drop any duplicates, even it means selecting more than n items.     Returns 
 DataFrame
    See also  DataFrame.nlargest

Return the first n rows ordered by columns in descending order.  DataFrame.sort_values

Sort DataFrame by the values.  DataFrame.head

Return the first n rows without re-ordering.    Examples 
>>> df = pd.DataFrame({'population': [59000000, 65000000, 434000,
...                                   434000, 434000, 337000, 337000,
...                                   11300, 11300],
...                    'GDP': [1937894, 2583560 , 12011, 4520, 12128,
...                            17036, 182, 38, 311],
...                    'alpha-2': ["IT", "FR", "MT", "MV", "BN",
...                                "IS", "NR", "TV", "AI"]},
...                   index=["Italy", "France", "Malta",
...                          "Maldives", "Brunei", "Iceland",
...                          "Nauru", "Tuvalu", "Anguilla"])
>>> df
          population      GDP alpha-2
Italy       59000000  1937894      IT
France      65000000  2583560      FR
Malta         434000    12011      MT
Maldives      434000     4520      MV
Brunei        434000    12128      BN
Iceland       337000    17036      IS
Nauru         337000      182      NR
Tuvalu         11300       38      TV
Anguilla       11300      311      AI
  In the following example, we will use nsmallest to select the three rows having the smallest values in column “population”. 
>>> df.nsmallest(3, 'population')
          population    GDP alpha-2
Tuvalu         11300     38      TV
Anguilla       11300    311      AI
Iceland       337000  17036      IS
  When using keep='last', ties are resolved in reverse order: 
>>> df.nsmallest(3, 'population', keep='last')
          population  GDP alpha-2
Anguilla       11300  311      AI
Tuvalu         11300   38      TV
Nauru         337000  182      NR
  When using keep='all', all duplicate items are maintained: 
>>> df.nsmallest(3, 'population', keep='all')
          population    GDP alpha-2
Tuvalu         11300     38      TV
Anguilla       11300    311      AI
Iceland       337000  17036      IS
Nauru         337000    182      NR
  To order by the smallest values in column “population” and then “GDP”, we can specify multiple columns like in the next example. 
>>> df.nsmallest(3, ['population', 'GDP'])
          population  GDP alpha-2
Tuvalu         11300   38      TV
Anguilla       11300  311      AI
Nauru         337000  182      NR
pandas.DataFrame.nunique   DataFrame.nunique(axis=0, dropna=True)[source]
 
Count number of distinct elements in specified axis. Return Series with number of distinct elements. Can ignore NaN values.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to use. 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise.  
dropna:bool, default True


Don’t include NaN in the counts.    Returns 
 Series
    See also  Series.nunique

Method nunique for Series.  DataFrame.count

Count non-NA cells for each column or row.    Examples 
>>> df = pd.DataFrame({'A': [4, 5, 6], 'B': [4, 1, 1]})
>>> df.nunique()
A    3
B    2
dtype: int64
  
>>> df.nunique(axis=1)
0    1
1    2
2    2
dtype: int64
pandas.DataFrame.pad   DataFrame.pad(axis=None, inplace=False, limit=None, downcast=None)[source]
 
Synonym for DataFrame.fillna() with method='ffill'.  Returns 
 Series/DataFrame or None

Object with missing values filled or None if inplace=True.
pandas.DataFrame.pct_change   DataFrame.pct_change(periods=1, fill_method='pad', limit=None, freq=None, **kwargs)[source]
 
Percentage change between the current and a prior element. Computes the percentage change from the immediately previous row by default. This is useful in comparing the percentage of change in a time series of elements.  Parameters 
 
periods:int, default 1


Periods to shift for forming percent change.  
fill_method:str, default ‘pad’


How to handle NAs before computing percent changes.  
limit:int, default None


The number of consecutive NAs to fill before stopping.  
freq:DateOffset, timedelta, or str, optional


Increment to use from time series API (e.g. ‘M’ or BDay()).  **kwargs

Additional keyword arguments are passed into DataFrame.shift or Series.shift.    Returns 
 
chg:Series or DataFrame


The same type as the calling object.      See also  Series.diff

Compute the difference of two elements in a Series.  DataFrame.diff

Compute the difference of two elements in a DataFrame.  Series.shift

Shift the index by some number of periods.  DataFrame.shift

Shift the index by some number of periods.    Examples Series 
>>> s = pd.Series([90, 91, 85])
>>> s
0    90
1    91
2    85
dtype: int64
  
>>> s.pct_change()
0         NaN
1    0.011111
2   -0.065934
dtype: float64
  
>>> s.pct_change(periods=2)
0         NaN
1         NaN
2   -0.055556
dtype: float64
  See the percentage change in a Series where filling NAs with last valid observation forward to next valid. 
>>> s = pd.Series([90, 91, None, 85])
>>> s
0    90.0
1    91.0
2     NaN
3    85.0
dtype: float64
  
>>> s.pct_change(fill_method='ffill')
0         NaN
1    0.011111
2    0.000000
3   -0.065934
dtype: float64
  DataFrame Percentage change in French franc, Deutsche Mark, and Italian lira from 1980-01-01 to 1980-03-01. 
>>> df = pd.DataFrame({
...     'FR': [4.0405, 4.0963, 4.3149],
...     'GR': [1.7246, 1.7482, 1.8519],
...     'IT': [804.74, 810.01, 860.13]},
...     index=['1980-01-01', '1980-02-01', '1980-03-01'])
>>> df
                FR      GR      IT
1980-01-01  4.0405  1.7246  804.74
1980-02-01  4.0963  1.7482  810.01
1980-03-01  4.3149  1.8519  860.13
  
>>> df.pct_change()
                  FR        GR        IT
1980-01-01       NaN       NaN       NaN
1980-02-01  0.013810  0.013684  0.006549
1980-03-01  0.053365  0.059318  0.061876
  Percentage of change in GOOG and APPL stock volume. Shows computing the percentage change between columns. 
>>> df = pd.DataFrame({
...     '2016': [1769950, 30586265],
...     '2015': [1500923, 40912316],
...     '2014': [1371819, 41403351]},
...     index=['GOOG', 'APPL'])
>>> df
          2016      2015      2014
GOOG   1769950   1500923   1371819
APPL  30586265  40912316  41403351
  
>>> df.pct_change(axis='columns', periods=-1)
          2016      2015  2014
GOOG  0.179241  0.094112   NaN
APPL -0.252395 -0.011860   NaN
pandas.DataFrame.pipe   DataFrame.pipe(func, *args, **kwargs)[source]
 
Apply chainable functions that expect Series or DataFrames.  Parameters 
 
func:function


Function to apply to the Series/DataFrame. args, and kwargs are passed into func. Alternatively a (callable, data_keyword) tuple where data_keyword is a string indicating the keyword of callable that expects the Series/DataFrame.  
args:iterable, optional


Positional arguments passed into func.  
kwargs:mapping, optional


A dictionary of keyword arguments passed into func.    Returns 
 
object:the return type of func.

    See also  DataFrame.apply

Apply a function along input axis of DataFrame.  DataFrame.applymap

Apply a function elementwise on a whole DataFrame.  Series.map

Apply a mapping correspondence on a Series.    Notes Use .pipe when chaining together functions that expect Series, DataFrames or GroupBy objects. Instead of writing 
>>> func(g(h(df), arg1=a), arg2=b, arg3=c)  
  You can write 
>>> (df.pipe(h)
...    .pipe(g, arg1=a)
...    .pipe(func, arg2=b, arg3=c)
... )  
  If you have a function that takes the data as (say) the second argument, pass a tuple indicating which keyword expects the data. For example, suppose f takes its data as arg2: 
>>> (df.pipe(h)
...    .pipe(g, arg1=a)
...    .pipe((func, 'arg2'), arg1=a, arg3=c)
...  )
pandas.DataFrame.plot.area   DataFrame.plot.area(x=None, y=None, **kwargs)[source]
 
Draw a stacked area plot. An area plot displays quantitative data visually. This function wraps the matplotlib area function.  Parameters 
 
x:label or position, optional


Coordinates for the X axis. By default uses the index.  
y:label or position, optional


Column to plot. By default uses all columns.  
stacked:bool, default True


Area plots are stacked by default. Set to False to create a unstacked plot.  **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns 
 matplotlib.axes.Axes or numpy.ndarray

Area plot, or array of area plots if subplots is True.      See also  DataFrame.plot

Make plots of DataFrame using matplotlib / pylab.    Examples Draw an area plot based on basic business metrics: 
>>> df = pd.DataFrame({
...     'sales': [3, 2, 3, 9, 10, 6],
...     'signups': [5, 5, 6, 12, 14, 13],
...     'visits': [20, 42, 28, 62, 81, 50],
... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
...                        freq='M'))
>>> ax = df.plot.area()
     Area plots are stacked by default. To produce an unstacked plot, pass stacked=False: 
>>> ax = df.plot.area(stacked=False)
     Draw an area plot for a single column: 
>>> ax = df.plot.area(y='sales')
     Draw with a different x: 
>>> df = pd.DataFrame({
...     'sales': [3, 2, 3],
...     'visits': [20, 42, 28],
...     'day': [1, 2, 3],
... })
>>> ax = df.plot.area(x='day')
pandas.DataFrame.plot.bar   DataFrame.plot.bar(x=None, y=None, **kwargs)[source]
 
Vertical bar plot. A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.  Parameters 
 
x:label or position, optional


Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.  
y:label or position, optional


Allows plotting of one column versus another. If not specified, all numerical columns are used.  
color:str, array-like, or dict, optional


The color for each of the DataFrame’s columns. Possible values are:  
 A single color string referred to by name, RGB or RGBA code,

for instance ‘red’ or ‘#a98d19’.    
 A sequence of color strings referred to by name, RGB or RGBA

code, which will be used for each column recursively. For instance [‘green’,’yellow’] each column’s bar will be filled in green or yellow, alternatively. If there is only a single column to be plotted, then only the first color from the color list will be used.    
 A dict of the form {column name:color}, so that each column will be


colored accordingly. For example, if your columns are called a and b, then passing {‘a’: ‘green’, ‘b’: ‘red’} will color bars for column a in green and bars for column b in red.      New in version 1.1.0.   **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns 
 matplotlib.axes.Axes or np.ndarray of them

An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.      See also  DataFrame.plot.barh

Horizontal bar plot.  DataFrame.plot

Make plots of a DataFrame.  matplotlib.pyplot.bar

Make a bar plot with matplotlib.    Examples Basic plot. 
>>> df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
>>> ax = df.plot.bar(x='lab', y='val', rot=0)
     Plot a whole dataframe to a bar plot. Each column is assigned a distinct color, and each row is nested in a group along the horizontal axis. 
>>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.bar(rot=0)
     Plot stacked bar charts for the DataFrame 
>>> ax = df.plot.bar(stacked=True)
     Instead of nesting, the figure can be split by column with subplots=True. In this case, a numpy.ndarray of matplotlib.axes.Axes are returned. 
>>> axes = df.plot.bar(rot=0, subplots=True)
>>> axes[1].legend(loc=2)  
     If you don’t like the default colours, you can specify how you’d like each column to be colored. 
>>> axes = df.plot.bar(
...     rot=0, subplots=True, color={"speed": "red", "lifespan": "green"}
... )
>>> axes[1].legend(loc=2)  
     Plot a single column. 
>>> ax = df.plot.bar(y='speed', rot=0)
     Plot only selected categories for the DataFrame. 
>>> ax = df.plot.bar(x='lifespan', rot=0)