Create timeseries dataframe with random data Parameters ---------- start : datetime (or datetime-like string) Start of time series end : datetime (or datetime-like string) End of time series dtypes : dict (optional) Mapping of column names to types.
(
start="2000-01-01",
end="2000-01-31",
freq="1s",
partition_freq="1D",
dtypes=None,
seed=None,
**kwargs,
)
| 8 | |
| 9 | |
| 10 | def timeseries( |
| 11 | start="2000-01-01", |
| 12 | end="2000-01-31", |
| 13 | freq="1s", |
| 14 | partition_freq="1D", |
| 15 | dtypes=None, |
| 16 | seed=None, |
| 17 | **kwargs, |
| 18 | ): |
| 19 | """Create timeseries dataframe with random data |
| 20 | |
| 21 | Parameters |
| 22 | ---------- |
| 23 | start : datetime (or datetime-like string) |
| 24 | Start of time series |
| 25 | end : datetime (or datetime-like string) |
| 26 | End of time series |
| 27 | dtypes : dict (optional) |
| 28 | Mapping of column names to types. |
| 29 | Valid types include {float, int, str, 'category'} |
| 30 | freq : string |
| 31 | String like '2s' or '1H' or '12W' for the time series frequency |
| 32 | partition_freq : string |
| 33 | String like '1M' or '2Y' to divide the dataframe into partitions |
| 34 | seed : int (optional) |
| 35 | Randomstate seed |
| 36 | kwargs: |
| 37 | Keywords to pass down to individual column creation functions. |
| 38 | Keywords should be prefixed by the column name and then an underscore. |
| 39 | |
| 40 | Examples |
| 41 | -------- |
| 42 | >>> import dask |
| 43 | >>> df = dask.datasets.timeseries() |
| 44 | >>> df.head() # doctest: +SKIP |
| 45 | timestamp id name x y |
| 46 | 2000-01-01 00:00:00 967 Jerry -0.031348 -0.040633 |
| 47 | 2000-01-01 00:00:01 1066 Michael -0.262136 0.307107 |
| 48 | 2000-01-01 00:00:02 988 Wendy -0.526331 0.128641 |
| 49 | 2000-01-01 00:00:03 1016 Yvonne 0.620456 0.767270 |
| 50 | 2000-01-01 00:00:04 998 Ursula 0.684902 -0.463278 |
| 51 | >>> df = dask.datasets.timeseries( |
| 52 | ... '2000', '2010', |
| 53 | ... freq='2h', partition_freq='1D', seed=1, # data frequency |
| 54 | ... dtypes={'value': float, 'name': str, 'id': int}, # data types |
| 55 | ... id_lam=1000 # control number of items in id column |
| 56 | ... ) |
| 57 | """ |
| 58 | from dask.dataframe.dask_expr.datasets import timeseries |
| 59 | |
| 60 | if dtypes is None: |
| 61 | dtypes = {"name": str, "id": int, "x": float, "y": float} |
| 62 | |
| 63 | return timeseries( |
| 64 | start=start, |
| 65 | end=end, |
| 66 | freq=freq, |
| 67 | partition_freq=partition_freq, |
nothing calls this directly
no outgoing calls
no test coverage detected