Python pandas.util.testing.all_timeseries_index_generator() Examples

The following are 1 code examples of pandas.util.testing.all_timeseries_index_generator(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.util.testing , or try the search function .
Example #1
Source File: test_resample.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_resample_empty_dtypes(self):

        # Empty series were sometimes causing a segfault (for the functions
        # with Cython bounds-checking disabled) or an IndexError.  We just run
        # them to ensure they no longer do.  (GH #10228)
        for index in tm.all_timeseries_index_generator(0):
            for dtype in (np.float, np.int, np.object, 'datetime64[ns]'):
                for how in downsample_methods + upsample_methods:
                    empty_series = pd.Series([], index, dtype)
                    try:
                        getattr(empty_series.resample('d'), how)()
                    except DataError:
                        # Ignore these since some combinations are invalid
                        # (ex: doing mean with dtype of np.object)
                        pass