hvplot 0.9.3a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. hvplot/__init__.py +322 -0
  2. hvplot/_version.py +16 -0
  3. hvplot/backend_transforms.py +329 -0
  4. hvplot/converter.py +2855 -0
  5. hvplot/cudf.py +26 -0
  6. hvplot/dask.py +42 -0
  7. hvplot/data/crime.csv +56 -0
  8. hvplot/datasets.yaml +48 -0
  9. hvplot/fugue.py +64 -0
  10. hvplot/ibis.py +21 -0
  11. hvplot/intake.py +32 -0
  12. hvplot/interactive.py +968 -0
  13. hvplot/networkx.py +625 -0
  14. hvplot/pandas.py +30 -0
  15. hvplot/plotting/__init__.py +63 -0
  16. hvplot/plotting/andrews_curves.py +99 -0
  17. hvplot/plotting/core.py +2288 -0
  18. hvplot/plotting/lag_plot.py +34 -0
  19. hvplot/plotting/parallel_coordinates.py +85 -0
  20. hvplot/plotting/scatter_matrix.py +220 -0
  21. hvplot/polars.py +21 -0
  22. hvplot/sample_data.py +30 -0
  23. hvplot/streamz.py +21 -0
  24. hvplot/tests/__init__.py +0 -0
  25. hvplot/tests/conftest.py +44 -0
  26. hvplot/tests/data/README.md +5 -0
  27. hvplot/tests/data/RGB-red.byte.tif +0 -0
  28. hvplot/tests/plotting/__init__.py +0 -0
  29. hvplot/tests/plotting/testcore.py +108 -0
  30. hvplot/tests/plotting/testohlc.py +34 -0
  31. hvplot/tests/plotting/testscattermatrix.py +138 -0
  32. hvplot/tests/test_links.py +99 -0
  33. hvplot/tests/testbackend_transforms.py +89 -0
  34. hvplot/tests/testcharts.py +452 -0
  35. hvplot/tests/testfugue.py +46 -0
  36. hvplot/tests/testgeo.py +468 -0
  37. hvplot/tests/testgeowithoutgv.py +60 -0
  38. hvplot/tests/testgridplots.py +259 -0
  39. hvplot/tests/testhelp.py +75 -0
  40. hvplot/tests/testibis.py +17 -0
  41. hvplot/tests/testinteractive.py +1442 -0
  42. hvplot/tests/testnetworkx.py +26 -0
  43. hvplot/tests/testoperations.py +385 -0
  44. hvplot/tests/testoptions.py +596 -0
  45. hvplot/tests/testoverrides.py +74 -0
  46. hvplot/tests/testpanel.py +70 -0
  47. hvplot/tests/testpatch.py +135 -0
  48. hvplot/tests/testplotting.py +69 -0
  49. hvplot/tests/teststreaming.py +28 -0
  50. hvplot/tests/testtransforms.py +39 -0
  51. hvplot/tests/testui.py +383 -0
  52. hvplot/tests/testutil.py +378 -0
  53. hvplot/tests/util.py +82 -0
  54. hvplot/ui.py +1032 -0
  55. hvplot/util.py +677 -0
  56. hvplot/utilities.py +129 -0
  57. hvplot/xarray.py +62 -0
  58. hvplot-0.9.3a1.dist-info/LICENSE +29 -0
  59. hvplot-0.9.3a1.dist-info/METADATA +243 -0
  60. hvplot-0.9.3a1.dist-info/RECORD +63 -0
  61. hvplot-0.9.3a1.dist-info/WHEEL +5 -0
  62. hvplot-0.9.3a1.dist-info/entry_points.txt +2 -0
  63. hvplot-0.9.3a1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,378 @@
1
+ """
2
+ Tests utilities to convert data and projections
3
+ """
4
+
5
+ import numpy as np
6
+ import pandas as pd
7
+ import pytest
8
+
9
+ from unittest import TestCase, SkipTest
10
+
11
+ from hvplot.util import (
12
+ check_crs,
13
+ is_list_like,
14
+ process_crs,
15
+ process_xarray,
16
+ _convert_col_names_to_str,
17
+ instantiate_crs_str,
18
+ )
19
+
20
+
21
+ class TestProcessXarray(TestCase):
22
+ def setUp(self):
23
+ try:
24
+ import xarray as xr
25
+ import pandas as pd # noqa
26
+ except ImportError:
27
+ raise SkipTest('xarray or pandas not available')
28
+ self.default_kwargs = {
29
+ 'value_label': 'value',
30
+ 'label': None,
31
+ 'gridded': False,
32
+ 'persist': False,
33
+ 'use_dask': False,
34
+ 'groupby': None,
35
+ 'y': None,
36
+ 'x': None,
37
+ 'by': None,
38
+ 'other_dims': [],
39
+ }
40
+ self.ds = xr.tutorial.open_dataset('air_temperature')
41
+
42
+ def test_process_1d_xarray_dataarray_with_no_coords(self):
43
+ import xarray as xr
44
+ import pandas as pd
45
+
46
+ da = xr.DataArray(data=[1, 2, 3])
47
+
48
+ data, x, y, by, groupby = process_xarray(data=da, **self.default_kwargs)
49
+ assert isinstance(data, pd.DataFrame)
50
+ assert x == 'index'
51
+ assert y == ['value']
52
+ assert not by
53
+ assert not groupby
54
+
55
+ def test_process_1d_xarray_dataarray_with_coords(self):
56
+ import xarray as xr
57
+ import pandas as pd
58
+
59
+ da = xr.DataArray(data=[1, 2, 3], coords={'day': [5, 6, 7]}, dims=['day'])
60
+
61
+ data, x, y, by, groupby = process_xarray(data=da, **self.default_kwargs)
62
+ assert isinstance(data, pd.DataFrame)
63
+ assert x == 'day'
64
+ assert y == ['value']
65
+ assert not by
66
+ assert not groupby
67
+
68
+ def test_process_1d_xarray_dataarray_with_coords_and_name(self):
69
+ import xarray as xr
70
+ import pandas as pd
71
+
72
+ da = xr.DataArray(data=[1, 2, 3], coords={'day': [5, 6, 7]}, dims=['day'], name='temp')
73
+
74
+ data, x, y, by, groupby = process_xarray(data=da, **self.default_kwargs)
75
+ assert isinstance(data, pd.DataFrame)
76
+ assert x == 'day'
77
+ assert y == ['temp']
78
+ assert not by
79
+ assert not groupby
80
+
81
+ def test_process_2d_xarray_dataarray_with_no_coords(self):
82
+ import xarray as xr
83
+ import pandas as pd
84
+
85
+ da = xr.DataArray(np.random.randn(4, 5))
86
+
87
+ data, x, y, by, groupby = process_xarray(data=da, **self.default_kwargs)
88
+ assert isinstance(data, pd.DataFrame)
89
+ assert x == 'index'
90
+ assert y == ['value']
91
+ assert not by
92
+ assert not groupby
93
+
94
+ def test_process_2d_xarray_dataarray_with_no_coords_as_gridded(self):
95
+ import xarray as xr
96
+
97
+ da = xr.DataArray(np.random.randn(4, 5))
98
+
99
+ kwargs = self.default_kwargs
100
+ kwargs.update(gridded=True)
101
+
102
+ data, x, y, by, groupby = process_xarray(data=da, **kwargs)
103
+ assert isinstance(data, xr.Dataset)
104
+ assert list(data.data_vars.keys()) == ['value']
105
+ assert x == 'dim_1'
106
+ assert y == 'dim_0'
107
+ assert not by
108
+ assert not groupby
109
+
110
+ def test_process_2d_xarray_dataarray_with_coords_as_gridded(self):
111
+ import xarray as xr
112
+
113
+ da = xr.DataArray(
114
+ data=np.random.randn(4, 5), coords={'y': [3, 4, 5, 6, 7]}, dims=['x', 'y']
115
+ )
116
+
117
+ kwargs = self.default_kwargs
118
+ kwargs.update(gridded=True)
119
+
120
+ data, x, y, by, groupby = process_xarray(data=da, **kwargs)
121
+ assert isinstance(data, xr.Dataset)
122
+ assert list(data.data_vars.keys()) == ['value']
123
+ assert x == 'y'
124
+ assert y == 'x'
125
+ assert not by
126
+ assert not groupby
127
+
128
+ def test_process_3d_xarray_dataset_with_coords(self):
129
+ import pandas as pd
130
+
131
+ data, x, y, by, groupby = process_xarray(data=self.ds, **self.default_kwargs)
132
+ assert isinstance(data, pd.DataFrame)
133
+ assert x == 'time'
134
+ assert y == ['air']
135
+ assert not by
136
+ assert groupby == ['lon', 'lat']
137
+
138
+ def test_process_3d_xarray_dataset_with_coords_as_gridded(self):
139
+ import xarray as xr
140
+
141
+ kwargs = self.default_kwargs
142
+ kwargs.update(gridded=True, x='lon', y='lat')
143
+
144
+ data, x, y, by, groupby = process_xarray(data=self.ds, **kwargs)
145
+ assert isinstance(data, xr.Dataset)
146
+ assert list(data.data_vars.keys()) == ['air']
147
+ assert x == 'lon'
148
+ assert y == 'lat'
149
+ assert by is None
150
+ assert groupby == ['time']
151
+
152
+ def test_process_3d_xarray_dataset_with_coords_as_gridded_uses_axis_to_get_defaults(self):
153
+ import xarray as xr
154
+
155
+ kwargs = self.default_kwargs
156
+ kwargs.update(gridded=True)
157
+
158
+ data, x, y, by, groupby = process_xarray(data=self.ds, **kwargs)
159
+ assert isinstance(data, xr.Dataset)
160
+ assert list(data.data_vars.keys()) == ['air']
161
+ assert x == 'lon'
162
+ assert y == 'lat'
163
+ assert not by
164
+ assert groupby == ['time']
165
+
166
+ def test_process_xarray_dataset_with_by_as_derived_datetime(self):
167
+ import pandas as pd
168
+
169
+ data = self.ds.mean(dim=['lat', 'lon'])
170
+ kwargs = self.default_kwargs
171
+ kwargs.update(gridded=False, y='air', by=['time.hour'])
172
+
173
+ data, x, y, by, groupby = process_xarray(data=data, **kwargs)
174
+ assert isinstance(data, pd.DataFrame)
175
+ assert x == 'time'
176
+ assert y == 'air'
177
+ assert by == ['time.hour']
178
+ assert not groupby
179
+
180
+ def test_process_xarray_dataset_with_x_as_derived_datetime(self):
181
+ import pandas as pd
182
+
183
+ data = self.ds.mean(dim=['lat', 'lon'])
184
+ kwargs = self.default_kwargs
185
+ kwargs.update(gridded=False, y='air', x='time.dayofyear')
186
+
187
+ data, x, y, by, groupby = process_xarray(data=data, **kwargs)
188
+ assert isinstance(data, pd.DataFrame)
189
+ assert x == 'time.dayofyear'
190
+ assert y == 'air'
191
+ assert not by
192
+ assert not groupby
193
+
194
+
195
+ class TestDynamicArgs(TestCase):
196
+ def setUp(self):
197
+ try:
198
+ import panel as pn # noqa
199
+ except ImportError:
200
+ raise SkipTest('panel not available')
201
+
202
+ def test_dynamic_and_static(self):
203
+ import panel as pn
204
+ from ..util import process_dynamic_args
205
+
206
+ x = 'sepal_width'
207
+ y = pn.widgets.Select(
208
+ name='y', value='sepal_length', options=['sepal_length', 'petal_length']
209
+ )
210
+ kind = pn.widgets.Select(name='kind', value='scatter', options=['bivariate', 'scatter'])
211
+
212
+ dynamic, arg_deps, arg_names = process_dynamic_args(x, y, kind)
213
+ assert 'x' not in dynamic
214
+ assert 'y' in dynamic
215
+ assert arg_deps == []
216
+
217
+ def test_dynamic_kwds(self):
218
+ import panel as pn
219
+ from ..util import process_dynamic_args
220
+
221
+ x = 'sepal_length'
222
+ y = 'sepal_width'
223
+ kind = 'scatter'
224
+ color = pn.widgets.ColorPicker(value='#ff0000')
225
+
226
+ dynamic, arg_deps, arg_names = process_dynamic_args(x, y, kind, c=color)
227
+ assert 'x' not in dynamic
228
+ assert 'c' in dynamic
229
+ assert arg_deps == []
230
+
231
+ def test_fn_kwds(self):
232
+ import panel as pn
233
+ from ..util import process_dynamic_args
234
+
235
+ x = 'sepal_length'
236
+ y = 'sepal_width'
237
+ kind = 'scatter'
238
+ by_species = pn.widgets.Checkbox(name='By species')
239
+ color = pn.widgets.ColorPicker(value='#ff0000')
240
+
241
+ @pn.depends(by_species.param.value, color.param.value)
242
+ def by_species_fn(by_species, color):
243
+ return 'species' if by_species else color
244
+
245
+ dynamic, arg_deps, arg_names = process_dynamic_args(x, y, kind, c=by_species_fn)
246
+ assert dynamic == {}
247
+ assert arg_names == ['c', 'c']
248
+ assert len(arg_deps) == 2
249
+
250
+
251
+ def test_check_crs():
252
+ pytest.importorskip('pyproj')
253
+ p = check_crs('epsg:26915 +units=m')
254
+ assert p.srs == '+proj=utm +zone=15 +datum=NAD83 +units=m +no_defs'
255
+ p = check_crs('wrong')
256
+ assert p is None
257
+
258
+
259
+ @pytest.mark.parametrize(
260
+ 'input',
261
+ [
262
+ '+init=epsg:26911',
263
+ ],
264
+ )
265
+ def test_process_crs(input):
266
+ pytest.importorskip('pyproj')
267
+ ccrs = pytest.importorskip('cartopy.crs')
268
+ crs = process_crs(input)
269
+ assert isinstance(crs, ccrs.CRS)
270
+
271
+
272
+ def test_process_crs_pyproj_crs():
273
+ pyproj = pytest.importorskip('pyproj')
274
+ ccrs = pytest.importorskip('cartopy.crs')
275
+ crs = process_crs(pyproj.CRS.from_epsg(4326))
276
+ assert isinstance(crs, ccrs.PlateCarree)
277
+
278
+
279
+ def test_process_crs_pyproj_proj():
280
+ pyproj = pytest.importorskip('pyproj')
281
+ ccrs = pytest.importorskip('cartopy.crs')
282
+ crs = process_crs(pyproj.Proj(init='epsg:4326'))
283
+ assert isinstance(crs, ccrs.PlateCarree)
284
+
285
+
286
+ @pytest.mark.parametrize(
287
+ 'input',
288
+ [
289
+ '4326',
290
+ 4326,
291
+ 'epsg:4326',
292
+ 'EPSG: 4326',
293
+ '+init=epsg:4326',
294
+ # Created with pyproj.CRS("EPSG:4326").to_wkt()
295
+ 'GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]',
296
+ ],
297
+ ids=lambda x: str(x)[:20],
298
+ )
299
+ def test_process_crs_platecarree(input):
300
+ pytest.importorskip('pyproj')
301
+ ccrs = pytest.importorskip('cartopy.crs')
302
+ crs = process_crs(input)
303
+ assert isinstance(crs, ccrs.PlateCarree)
304
+
305
+
306
+ @pytest.mark.parametrize(
307
+ 'input',
308
+ [
309
+ '3857',
310
+ 3857,
311
+ 'epsg:3857',
312
+ 'EPSG: 3857',
313
+ '+init=epsg:3857',
314
+ 'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]',
315
+ # Created with pyproj.CRS("EPSG:3857").to_wkt()
316
+ 'PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]]',
317
+ ],
318
+ ids=lambda x: str(x)[:20],
319
+ )
320
+ def test_process_crs_mercator(input):
321
+ pytest.importorskip('pyproj')
322
+ ccrs = pytest.importorskip('cartopy.crs')
323
+ crs = process_crs(input)
324
+ assert isinstance(crs, ccrs.Mercator)
325
+
326
+
327
+ def test_process_crs_rasterio():
328
+ pytest.importorskip('pyproj')
329
+ rcrs = pytest.importorskip('rasterio.crs')
330
+ ccrs = pytest.importorskip('cartopy.crs')
331
+ input = rcrs.CRS.from_epsg(4326).to_wkt()
332
+ crs = process_crs(input)
333
+ assert isinstance(crs, ccrs.CRS)
334
+
335
+
336
+ def test_process_crs_raises_error():
337
+ pytest.importorskip('pyproj')
338
+ pytest.importorskip('cartopy.crs')
339
+ with pytest.raises(ValueError, match='must be defined as a EPSG code, proj4 string'):
340
+ process_crs(43823)
341
+
342
+
343
+ def test_is_list_like():
344
+ assert not is_list_like(0)
345
+ assert not is_list_like('string')
346
+ assert not is_list_like(np.array('a'))
347
+ assert is_list_like(['a', 'b'])
348
+ assert is_list_like(('a', 'b'))
349
+ assert is_list_like({'a', 'b'})
350
+ assert is_list_like(pd.Series(['a', 'b']))
351
+ assert is_list_like(pd.Index(['a', 'b']))
352
+ assert is_list_like(np.array(['a', 'b']))
353
+
354
+
355
+ def test_convert_col_names_to_str():
356
+ df = pd.DataFrame(np.random.random((10, 2)))
357
+ assert all(not isinstance(col, str) for col in df.columns)
358
+ df = _convert_col_names_to_str(df)
359
+ assert all(isinstance(col, str) for col in df.columns)
360
+
361
+
362
+ def test_instantiate_crs_str():
363
+ ccrs = pytest.importorskip('cartopy.crs')
364
+ assert isinstance(instantiate_crs_str('PlateCarree'), ccrs.PlateCarree)
365
+
366
+
367
+ def test_instantiate_crs_google_mercator():
368
+ ccrs = pytest.importorskip('cartopy.crs')
369
+ assert instantiate_crs_str('GOOGLE_MERCATOR') == ccrs.GOOGLE_MERCATOR
370
+ assert instantiate_crs_str('google_mercator') == ccrs.GOOGLE_MERCATOR
371
+
372
+
373
+ def test_instantiate_crs_str_kwargs():
374
+ ccrs = pytest.importorskip('cartopy.crs')
375
+ crs = instantiate_crs_str('PlateCarree', globe=ccrs.Globe(datum='WGS84'))
376
+ assert isinstance(crs, ccrs.PlateCarree)
377
+ assert isinstance(crs.globe, ccrs.Globe)
378
+ assert crs.globe.datum == 'WGS84'
hvplot/tests/util.py ADDED
@@ -0,0 +1,82 @@
1
+ import string
2
+
3
+ from datetime import datetime
4
+
5
+ import numpy as np
6
+ import pandas as pd
7
+
8
+
9
+ # Pandas removed its make<> test utilities in version 2.2.0.
10
+
11
+ _N = 30
12
+ _K = 4
13
+
14
+
15
+ def getCols(k):
16
+ return string.ascii_uppercase[:k]
17
+
18
+
19
+ def rands_array(nchars, size, dtype='O', replace=True):
20
+ """
21
+ Generate an array of byte strings.
22
+ """
23
+ chars = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1))
24
+ retval = (
25
+ np.random.default_rng(2)
26
+ .choice(chars, size=nchars * np.prod(size), replace=replace)
27
+ .view((np.str_, nchars))
28
+ .reshape(size)
29
+ )
30
+ return retval.astype(dtype)
31
+
32
+
33
+ def makeStringIndex(k=10, name=None):
34
+ return pd.Index(rands_array(nchars=10, size=k), name=name)
35
+
36
+
37
+ def makeMixedDataFrame():
38
+ data = {
39
+ 'A': [0.0, 1.0, 2.0, 3.0, 4.0],
40
+ 'B': [0.0, 1.0, 0.0, 1.0, 0.0],
41
+ 'C': ['foo1', 'foo2', 'foo3', 'foo4', 'foo5'],
42
+ 'D': pd.bdate_range('1/1/2009', periods=5),
43
+ }
44
+ return pd.DataFrame(data)
45
+
46
+
47
+ def getSeriesData():
48
+ index = makeStringIndex(_N)
49
+ return {
50
+ c: pd.Series(np.random.default_rng(i).standard_normal(_N), index=index)
51
+ for i, c in enumerate(getCols(_K))
52
+ }
53
+
54
+
55
+ def makeDataFrame():
56
+ data = getSeriesData()
57
+ return pd.DataFrame(data)
58
+
59
+
60
+ def makeDateIndex(k=10, freq='B', name=None, **kwargs):
61
+ dt = datetime(2000, 1, 1)
62
+ dr = pd.bdate_range(dt, periods=k, freq=freq, name=name)
63
+ return pd.DatetimeIndex(dr, name=name, **kwargs)
64
+
65
+
66
+ def makeTimeSeries(nper=None, freq='B', name=None):
67
+ if nper is None:
68
+ nper = _N
69
+ return pd.Series(
70
+ np.random.default_rng(2).standard_normal(nper),
71
+ index=makeDateIndex(nper, freq=freq),
72
+ name=name,
73
+ )
74
+
75
+
76
+ def getTimeSeriesData(nper=None, freq='B'):
77
+ return {c: makeTimeSeries(nper, freq) for c in getCols(_K)}
78
+
79
+
80
+ def makeTimeDataFrame(nper=None, freq='B'):
81
+ data = getTimeSeriesData(nper, freq)
82
+ return pd.DataFrame(data)