diff --git a/docs/methods_and_properties.md b/docs/methods_and_properties.md index 0be26b467058b4c6ae87b3397ac02a1b7ac0c719..f8231b169742769f602cee94bda785b3d7f927d3 100644 --- a/docs/methods_and_properties.md +++ b/docs/methods_and_properties.md @@ -7,30 +7,41 @@ Methods Brief - `copy(deep=True)` : Return a copy. See also [pandas.DataFrame.copy]( https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.copy.html) - - `copy_empty()` : Return a new DictOfSeries object, with same properties than the original. + - [copy_empty()](#diosdictofseriescopy_empty) : Return a new DictOfSeries object, with same properties than the original. - `all(axis=0)` : Return whether all elements are True, potentially over an axis. See also [pandas.DataFrame.all]( https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.all.html) - `any(axis=0)` : Return whether any element is True, potentially over an axis. See also [pandas.DataFrame.any]( https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.any.html) - - `squeeze(axis=None)` : Squeeze a 1-dimensional axis objects into scalars. Eg. a 1-column Dios is squeezes to the - underling Series. If `axis=None` it is also tried, to squeeze the possibly returned Series, from the (outer) - Dios-squeeze. + - `squeeze(axis=None)` : Squeeze a 1-dimensional axis objects into scalars. See also [pandas.DataFrame.squeeze](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.squeeze.html) - - `to_df()` : Transform the Dios to a pandas.DataFrame + - [to_df()](#diosdictofseriesto_df) : Transform the Dios to a pandas.DataFrame - `to_string(kwargs)` : Return a string representation of the Dios. - - `apply(func, args=(), **kwds)` : apply the given function to every column in the dios eg. + - [apply()](#diosdictofseriesapply) : apply the given function to every column in the dios eg. - `astype()` : Cast the data to the given data type. - `isin()` : return a boolean dios, that indicates if the corresponding value is in the given array-like - `isna()` : Return a bolean array that is `True` if the value is a Nan-value - `notna()` : inverse of `isnan()` - `dropna()` : drop all Nan-values - - `index_of(method='union)`: Return a single(!) Index that is constructed from all the indexes of the columns. - - `in` - - `is` + - [index_of()](#diosdictofseriesindex_of): Return a single(!) Index that is constructed from all the indexes of the columns. - `len(Dios)` : return the number of columns the dios has. - `copy_empty(columns=True)` - -------------------------- + +Properties +---------- +- `columns` : Column index +- `indexes` : Series of indexes of columns +- `lengths` : Series of lengths of columns +- `values` : A array of length of the columns, with arrays of values, as sub-arrays +- `dtypes` : Series of dtypes of columns +- `itype` : The index type the Dios accept +- `empty` : True if the dios holds no data. Nevertheless the dios can have empty columns. + + +dios.DictOfSeries.copy_empty + --------------------------- + +`DictOfSeries.copy_empty(columns=True)` + Return a new DictOfSeries object, with same properties than the original. If `columns=True`, the copy will have the same, but empty columns like the original. @@ -60,8 +71,11 @@ Columns: [] ``` -`to_df()` ---------- +dios.DictOfSeries.to_df +---------------------- + +`DictOfSeries.to_df()` + Transform the Dios to a pandas.DataFrame. Missing common indices are filled with NaN's. **Examples** @@ -90,9 +104,11 @@ columns a b c d 10 NaN NaN NaN 4.0 ``` + dios.DictOfSeries.apply -------------------------------------------------- -`apply(func, axis=0, raw=False, args=(), **kwds)` +----------------------- + +`DictOfSeries.apply(func, axis=0, raw=False, args=(), **kwds)` Apply the given function to every column in the dios. This is a very mighty tool to apply functions that are defined on pandas.Series to multiple columns. @@ -187,21 +203,51 @@ dtype: object dios.DictOfSeries.index_of --------------------------- -`index_of(method='union)` +`DictOfSeries.index_of(method='union)` -: return a single(!) Index that is constructed from all the indexes of the columns. - - - - +Aggregate indexes of all columns to one index by a given method. + + +**Parameters:** + - **method : str, default "union"** + + Aggregation method + - 'all' : get all indices from all columns + - 'shared' : get indices that are present in every columns + - 'uniques' : get indices that are only present in a single column + - 'union' : alias for 'all' + - 'intersection' : alias for 'shared' + - 'non-uniques' : get indices that are present in more than one column + + - **axis : {0 or ‘index’, 1 or ‘columns’}, default 0** -Properties ----------- -- `columns` : Column index -- `indexes` : Series of indexes of columns -- `lengths` : Series of lengths of columns -- `values` : A array of length of the columns, with arrays of values, as sub-arrays -- `dtypes` : Series of dtypes of columns -- `itype` : The index type the Dios accept -- `empty` : True if the dios holds no data. Nevertheless the dios can have empty columns. +**Returns: pandas.Index** + +The aggregated Index + +**Examples** +``` +>>> di + a | b | c | d | +===== | ====== | ====== | ===== | +0 0 | 2 5 | 4 7 | 6 0 | +1 7 | 3 6 | 5 17 | 7 1 | +2 14 | 4 7 | 6 27 | 8 2 | +3 21 | 5 8 | 7 37 | 9 3 | +4 28 | 6 9 | 8 47 | 10 4 | +5 35 | 7 10 | 9 57 | 11 5 | +6 42 | 8 11 | 10 67 | 12 6 | +7 49 | 9 12 | 11 77 | 13 7 | +8 56 | 10 13 | 12 87 | 14 8 | +9 63 | 11 14 | 13 97 | 15 9 | + +>>> di.index_of() +RangeIndex(start=0, stop=16, step=1) + +>>> di.index_of("shared") +Int64Index([6, 7, 8, 9], dtype='int64') + +>>> di.index_of("uniques") +Int64Index([0, 1, 14, 15], dtype='int64') +```