Skip to content
Snippets Groups Projects
Commit 2207db3f authored by Bert Palm's avatar Bert Palm 🎇
Browse files

save

parent 4a0fb4b0
No related branches found
No related tags found
No related merge requests found
......@@ -318,6 +318,7 @@ class _DiosBase:
@property
def columns(self):
""" The column labels of the DictOfSeries """
return self._data.index
@columns.setter
......@@ -329,6 +330,10 @@ class _DiosBase:
@property
def itype(self):
""" The ``Itype`` of the DictOfSeries.
See :ref:`Itype documentation <doc_itype:Itype>` for more info.
"""
if self._itype == 'INFER':
return None
return self._itype
......@@ -341,6 +346,10 @@ class _DiosBase:
@property
def cast_policy(self):
""" The policy to use for casting new columns if its initial itype does not fit.
See :ref:`Itype documentation <doc_itype:Itype>` for more info.
"""
return self._policy
@cast_policy.setter
......@@ -363,6 +372,47 @@ class _DiosBase:
@property
def empty(self):
""" Indicator whether DictOfSeries is empty.
Returns
-------
bool :
If DictOfSeries is empty, return True, if not return False.
See Also
--------
DictOfSeries.dropempty : drop empty columns
DictOfSeries.dropna : drop NAN's from a DictOfSeries
pandas.Series.dropna : drop NAN's from a Series
Notes
-----
If DictOfSeries contains only NaNs, it is still not considered empty. See the example below.
Examples
--------
An example of an actual empty DictOfSeries.
>>> di_empty = DictOfSeries(columns=['A'])
>>> di_empty
Empty DictOfSeries
Columns: ['A']
>>> di_empty.empty
True
If we only have NaNs in our DictOfSeries, it is not considered empty!
We will need to drop the NaNs to make the DictOfSeries empty:
>>> di = pd.DictOfSeries({'A' : [np.nan]})
>>> di
A |
===== |
0 NaN |
>>> di.empty
False
>>> di.dropna().empty
True
"""
return len(self) == 0 or all(s.empty for s in self._data)
def __iter__(self):
......@@ -384,6 +434,22 @@ class _DiosBase:
return self.copy(deep=True)
def copy(self, deep=True):
""" Make a copy of this DictOfSeries' indices and data.
Parameters
----------
deep : bool, default True
Make a deep copy, including a copy of the data and the indices.
With deep=False neither the indices nor the data are copied.
Returns
-------
copy : DictOfSeries
See Also
--------
pandas.DataFrame.copy
"""
if deep:
data = pd.Series(dtype='O', index=self.columns)
for c in self.columns:
......@@ -479,6 +545,10 @@ class _DiosBase:
@property
def loc(self):
""" Location Indexer.
See :ref:`indexing docs <doc_indexing:Pandas-like indexing>`
"""
return _LocIndexer(self)
@property
......
File moved
File moved
File moved
Itype
=====
\ No newline at end of file
......@@ -15,22 +15,26 @@ the class :class:`dios.DictOfSeries`. See
dios.DictOfSeries <_api/dios.DictOfSeries>
For some recipes and advanced usage see:
Most magic happen in getting and setting elements.
To select any combination from columns and rows,
read the documentation about indexing:
.. toctree::
indexingDocs
doc_indexing
.. toctree::
cookbook
doc_cookbook
For full module api documentation see:
For implemented methods and module functions,
respectively the full module api, see:
.. toctree::
:maxdepth: 2
_diosApi
dios_api
or browse the Index..
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment