id int64 0 2.13k | file_path stringlengths 38 93 | function_signature stringlengths 9 64 | body stringlengths 6 16.2k | parameters stringlengths 8 16.8k | examples stringlengths 2 6.12k | content stringlengths 31 16.3k | embeddings sequencelengths 768 768 |
|---|---|---|---|---|---|---|---|
0 | ..\pandas\reference\api\pandas.Series.cat.reorder_categories.html | pandas.Series.cat.reorder_categories | Series.cat.reorder_categories(*args, **kwargs)[source]# Reorder categories as specified in new_categories. new_categories need to include all old categories and no new category items. | Parameters: new_categoriesIndex-likeThe categories in new order. orderedbool, optionalWhether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information. Returns: CategoricalCategorical with reordered categories. Raises: ValueErrorIf the new categories do not contain... | [">>> ser = pd.Series(['a', 'b', 'c', 'a'], dtype='category')\n>>> ser = ser.cat.reorder_categories(['c', 'b', 'a'], ordered=True)\n>>> ser\n0 a\n1 b\n2 c\n3 a\ndtype: category\nCategories (3, object): ['c' < 'b' < 'a']", ">>> ser.sort_values()\n2 c\n1 b\n0 a\n3 a\ndtype: category\nCategories (3, object... | pandas.Series.cat.reorder_categories
Series.cat.reorder_categories(*args, **kwargs)[source]# Reorder categories as specified in new_categories. new_categories need to include all old categories and no new category items. | [
0.1743732988834381,
0.010410141199827194,
-0.20261168479919434,
-0.029423292726278305,
0.19112850725650787,
0.2476331740617752,
0.07028717547655106,
0.41453731060028076,
-0.10115280002355576,
-0.054558802396059036,
-0.17567071318626404,
0.22543145716190338,
0.059176329523324966,
-0.0656451... |
1 | ..\pandas\reference\api\pandas.Index.union.html | pandas.Index.union | final Index.union(other, sort=None)[source]# Form the union of two Index objects. If the Index objects are incompatible, both Index objects will be cast to dtype(‘object’) first. | Parameters: otherIndex or array-like sortbool or None, default NoneWhether to sort the resulting Index. None : Sort the result, except when self and other are equal. self or other has length 0. Some values in self or other cannot be compared. A RuntimeWarning is issued in this case. False : do not sort the result. True... | [">>> idx1 = pd.Index([1, 2, 3, 4])\n>>> idx2 = pd.Index([3, 4, 5, 6])\n>>> idx1.union(idx2)\nIndex([1, 2, 3, 4, 5, 6], dtype='int64')", ">>> idx1 = pd.Index(['a', 'b', 'c', 'd'])\n>>> idx2 = pd.Index([1, 2, 3, 4])\n>>> idx1.union(idx2)\nIndex(['a', 'b', 'c', 'd', 1, 2, 3, 4], dtype='object')", '>>> idx1 = pd.MultiInde... | pandas.Index.union
final Index.union(other, sort=None)[source]# Form the union of two Index objects. If the Index objects are incompatible, both Index objects will be cast to dtype(‘object’) first. | [
0.06122520938515663,
-0.39517271518707275,
-0.11384187638759613,
0.050392135977745056,
0.06906662881374359,
0.28888291120529175,
0.08519402891397476,
0.2582961916923523,
0.03239767625927925,
0.06703005731105804,
-0.3115507662296295,
0.03497869148850441,
0.16140946745872498,
0.0508351102471... |
2 | ..\pandas\reference\api\pandas.api.extensions.ExtensionArray.argsort.html | pandas.api.extensions.ExtensionArray.argsort | ExtensionArray.argsort(*, ascending=True, kind='quicksort', na_position='last', **kwargs)[source]# Return the indices that would sort this array. | Parameters: ascendingbool, default TrueWhether the indices should result in an ascending or descending sort. kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optionalSorting algorithm. na_position{‘first’, ‘last’}, default ‘last’If 'first', put NaN values at the beginning. If 'last', put NaN values at the end. *ar... | ['>>> arr = pd.array([3, 1, 2, 5, 4])\n>>> arr.argsort()\narray([1, 2, 0, 4, 3])'] | pandas.api.extensions.ExtensionArray.argsort
ExtensionArray.argsort(*, ascending=True, kind='quicksort', na_position='last', **kwargs)[source]# Return the indices that would sort this array. | [
0.42583590745925903,
-0.45916426181793213,
-0.2389986664056778,
0.037390466779470444,
0.2420763224363327,
0.28333768248558044,
-0.1429510861635208,
0.33295923471450806,
-0.015330441296100616,
0.3166268467903137,
-0.23578789830207825,
0.24674224853515625,
0.07156559824943542,
-0.06646988540... |
3 | ..\pandas\reference\api\pandas.DataFrame.reset_index.html | pandas.DataFrame.reset_index | DataFrame.reset_index(level=None, *, drop=False, inplace=False, col_level=0, col_fill='', allow_duplicates=<no_default>, names=None)[source]# Reset the index, or a level of it. Reset the index of the DataFrame, and use the default one instead. If the DataFrame has a MultiIndex, this method can remove one or more levels... | Parameters: levelint, str, tuple, or list, default NoneOnly remove the given levels from the index. Removes all levels by default. dropbool, default FalseDo not try to insert index into dataframe columns. This resets the index to the default integer index. inplacebool, default FalseWhether to modify the DataFrame rathe... | [">>> df = pd.DataFrame([('bird', 389.0),\n... ('bird', 24.0),\n... ('mammal', 80.5),\n... ('mammal', np.nan)],\n... index=['falcon', 'parrot', 'lion', 'monkey'],\n... columns=('class', 'max_speed'))\n>>> df\n class ma... | pandas.DataFrame.reset_index
DataFrame.reset_index(level=None, *, drop=False, inplace=False, col_level=0, col_fill='', allow_duplicates=<no_default>, names=None)[source]# Reset the index, or a level of it. Reset the index of the DataFrame, and use the default one instead. If the DataFrame has a MultiIndex, this method ... | [
0.02651648223400116,
-0.26891571283340454,
-0.1850941777229309,
0.021301522850990295,
0.06572160869836807,
0.21839478611946106,
0.4030283987522125,
0.249111607670784,
0.05866248905658722,
0.33151566982269287,
-0.2785235643386841,
0.2798389494419098,
0.1359468251466751,
0.23915448784828186,... |
4 | ..\pandas\reference\api\pandas.Series.cat.set_categories.html | pandas.Series.cat.set_categories | Series.cat.set_categories(*args, **kwargs)[source]# Set the categories to the specified new categories. new_categories can include new categories (which will result in unused categories) or remove old categories (which results in values set to NaN). If rename=True, the categories will simply be renamed (less or more it... | Parameters: new_categoriesIndex-likeThe categories in new order. orderedbool, default FalseWhether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information. renamebool, default FalseWhether or not the new_categories should be considered as a rename of the old categ... | [">>> raw_cat = pd.Categorical(['a', 'b', 'c', 'A'],\n... categories=['a', 'b', 'c'], ordered=True)\n>>> ser = pd.Series(raw_cat)\n>>> ser\n0 a\n1 b\n2 c\n3 NaN\ndtype: category\nCategories (3, object): ['a' < 'b' < 'c']", ">>> ser.cat.set_categories(['A', 'B', 'C'], rename=True)\n0 ... | pandas.Series.cat.set_categories
Series.cat.set_categories(*args, **kwargs)[source]# Set the categories to the specified new categories. new_categories can include new categories (which will result in unused categories) or remove old categories (which results in values set to NaN). If rename=True, the categories will s... | [
0.2757214605808258,
-0.07529807835817337,
-0.14921633899211884,
-0.09256383031606674,
0.12990713119506836,
0.31438833475112915,
0.23177385330200195,
0.24116931855678558,
-0.30898964405059814,
0.10925377160310745,
-0.3287297189235687,
0.18066655099391937,
0.04052772745490074,
-0.12488977611... |
5 | ..\pandas\reference\api\pandas.Series.to_csv.html | pandas.Series.to_csv | Series.to_csv(path_or_buf=None, *, sep=',', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', encoding=None, compression='infer', quoting=None, quotechar='"', lineterminator=None, chunksize=None, date_format=None, doublequote=True, escapechar=None, decimal='.', errors='str... | Parameters: path_or_bufstr, path object, file-like object, or None, default NoneString, path object (implementing os.PathLike[str]), or file-like object implementing a write() function. If None, the result is returned as a string. If a non-binary file object is passed, it should be opened with newline=’’, disabling uni... | [">>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],\n... 'mask': ['red', 'purple'],\n... 'weapon': ['sai', 'bo staff']})\n>>> df.to_csv('out.csv', index=False)", ">>> df.to_csv(index=False)\n'name,mask,weapon\\nRaphael,red,sai\\nDonatello,purple,bo staff\\n'\n>>> compression... | pandas.Series.to_csv
Series.to_csv(path_or_buf=None, *, sep=',', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', encoding=None, compression='infer', quoting=None, quotechar='"', lineterminator=None, chunksize=None, date_format=None, doublequote=True, escapechar=None, dec... | [
0.0003060437156818807,
-0.10263757407665253,
-0.2104552835226059,
0.07009566575288773,
0.35673844814300537,
0.2621782124042511,
0.20084398984909058,
0.5478160381317139,
0.05385109782218933,
0.1304100751876831,
0.0460737980902195,
0.2863556742668152,
0.06558741629123688,
0.19931679964065552... |
6 | ..\pandas\reference\api\pandas.tseries.offsets.Milli.delta.html | pandas.tseries.offsets.Milli.delta | Milli.delta# | No parameters found | [] | pandas.tseries.offsets.Milli.delta
Milli.delta# | [
-0.2962976098060608,
-0.6011965870857239,
-0.27237850427627563,
0.0012208892730996013,
0.08896516263484955,
0.06200403347611427,
0.31093695759773254,
0.055634237825870514,
-0.3121865689754486,
0.2483321577310562,
0.1478181928396225,
0.15999971330165863,
0.1228051409125328,
0.36816886067390... |
7 | ..\pandas\reference\api\pandas.core.groupby.SeriesGroupBy.ngroup.html | pandas.core.groupby.SeriesGroupBy.ngroup | SeriesGroupBy.ngroup(ascending=True)[source]# Number each group from 0 to the number of groups - 1. This is the enumerative complement of cumcount. Note that the numbers given to the groups match the order in which the groups would be seen when iterating over the groupby object, not the order they are first observed. ... | Parameters: ascendingbool, default TrueIf False, number in reverse, from number of group - 1 to 0. Returns: SeriesUnique numbers for each group. | ['>>> df = pd.DataFrame({"color": ["red", None, "red", "blue", "blue", "red"]})\n>>> df\n color\n0 red\n1 None\n2 red\n3 blue\n4 blue\n5 red\n>>> df.groupby("color").ngroup()\n0 1.0\n1 NaN\n2 1.0\n3 0.0\n4 0.0\n5 1.0\ndtype: float64\n>>> df.groupby("color", dropna=False).ngroup()\n0 ... | pandas.core.groupby.SeriesGroupBy.ngroup
SeriesGroupBy.ngroup(ascending=True)[source]# Number each group from 0 to the number of groups - 1. This is the enumerative complement of cumcount. Note that the numbers given to the groups match the order in which the groups would be seen when iterating over the groupby object... | [
-0.061997901648283005,
-0.2727109491825104,
-0.15349817276000977,
0.09646670520305634,
-0.13349242508411407,
0.3637765645980835,
0.22620482742786407,
0.005550822243094444,
0.015044666826725006,
0.23986129462718964,
-0.15020033717155457,
-0.06924748420715332,
0.3183963894844055,
-0.03784231... |
8 | ..\pandas\reference\api\pandas.tseries.offsets.BYearBegin.freqstr.html | pandas.tseries.offsets.BYearBegin.freqstr | BYearBegin.freqstr# Return a string representing the frequency. | No parameters found | [">>> pd.DateOffset(5).freqstr\n'<5 * DateOffsets>'", ">>> pd.offsets.BusinessHour(2).freqstr\n'2bh'", ">>> pd.offsets.Nano().freqstr\n'ns'", ">>> pd.offsets.Nano(-3).freqstr\n'-3ns'"] | pandas.tseries.offsets.BYearBegin.freqstr
BYearBegin.freqstr# Return a string representing the frequency. | [
-0.2928342819213867,
-0.6248272657394409,
-0.1807110756635666,
0.01242088433355093,
0.0965292677283287,
-0.0068465727381408215,
0.14047442376613617,
0.12596817314624786,
-0.23005536198616028,
0.30317872762680054,
-0.15295591950416565,
-0.0164842139929533,
0.056463491171598434,
0.1880466938... |
9 | ..\pandas\reference\api\pandas.Index.unique.html | pandas.Index.unique | Index.unique(level=None)[source]# Return unique values in the index. Unique values are returned in order of appearance, this does NOT sort. | Parameters: levelint or hashable, optionalOnly return values from specified level (for MultiIndex). If int, gets the level by integer position, else by level name. Returns: Index | [">>> idx = pd.Index([1, 1, 2, 3, 3])\n>>> idx.unique()\nIndex([1, 2, 3], dtype='int64')"] | pandas.Index.unique
Index.unique(level=None)[source]# Return unique values in the index. Unique values are returned in order of appearance, this does NOT sort. | [
0.250370055437088,
-0.4259299635887146,
-0.204690083861351,
0.17691700160503387,
0.09586609899997711,
0.15956319868564606,
0.2561158835887909,
0.1849251389503479,
-0.11676943302154541,
0.27294978499412537,
-0.25583815574645996,
0.3397311866283417,
0.02956288494169712,
0.10479648411273956,
... |
10 | ..\pandas\reference\api\pandas.api.extensions.ExtensionArray.astype.html | pandas.api.extensions.ExtensionArray.astype | ExtensionArray.astype(dtype, copy=True)[source]# Cast to a NumPy array or ExtensionArray with ‘dtype’. | Parameters: dtypestr or dtypeTypecode or data-type to which the array is cast. copybool, default TrueWhether to copy the data, even if not necessary. If False, a copy is made only if the old dtype does not match the new dtype. Returns: np.ndarray or pandas.api.extensions.ExtensionArrayAn ExtensionArray if dtype is Exte... | ['>>> arr = pd.array([1, 2, 3])\n>>> arr\n<IntegerArray>\n[1, 2, 3]\nLength: 3, dtype: Int64', ">>> arr1 = arr.astype('Float64')\n>>> arr1\n<FloatingArray>\n[1.0, 2.0, 3.0]\nLength: 3, dtype: Float64\n>>> arr1.dtype\nFloat64Dtype()", ">>> arr2 = arr.astype('float64')\n>>> arr2\narray([1., 2., 3.])\n>>> arr2.dtype\ndtyp... | pandas.api.extensions.ExtensionArray.astype
ExtensionArray.astype(dtype, copy=True)[source]# Cast to a NumPy array or ExtensionArray with ‘dtype’. | [
0.10765499621629715,
-0.43835732340812683,
-0.11284776031970978,
0.04972665756940842,
0.5462608337402344,
0.22064009308815002,
0.1701744645833969,
0.33484914898872375,
0.0939728170633316,
0.0323631577193737,
-0.17115174233913422,
0.4402351975440979,
-0.3562995493412018,
0.07489725947380066... |
End of preview. Expand in Data Studio
- Downloads last month
- 4