Skip to content

Commit a3e7228

Browse files
committed
More anvanced examples in readme
1 parent b96c2ac commit a3e7228

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

README.rst

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,30 @@ a more extensive list on API and usage.
5252
.multi_sample
5353
.sample_proportion
5454
55-
Dataset from subscriptable
56-
--------------------------
55+
Construct informative batches
56+
-----------------------------
5757

58-
.. code-block:: python
58+
>>> datastream = Datastream.merge([
59+
... (apple_datastream, 2),
60+
... (pear_datastream, 1),
61+
... (banana_datastream, 1),
62+
... ])
63+
... next(iter(datastream.data_loader(batch_size=6)))
64+
['apple', 'apple', 'pear', 'banana', 'apple', 'apple']
5965

60-
from datastream import Dataset
6166

62-
fruits_and_cost = (
63-
('apple', 5),
64-
('pear', 7),
65-
('banana', 14),
66-
('kiwi', 100),
67-
)
67+
Zip independently sampled datastreams
68+
-------------------------------------
6869

69-
dataset = (
70-
Dataset.from_subscriptable(fruits_and_cost)
71-
.map(lambda fruit, cost: (
72-
fruit,
73-
cost * 2,
74-
))
75-
)
70+
.. code-block:: python
7671
77-
print(dataset[2]) # ('banana', 28)
72+
datastream = Datastream.zip([
73+
apple_datastream,
74+
Datastream.merge([pear_datastream, banana_datastream])
75+
])
7876
79-
Dataset from pandas dataframe
80-
-----------------------------
77+
Pipeline functions
78+
------------------
8179

8280
.. code-block:: python
8381

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
python_files = *.py
33
norecursedirs = venv __pycache__ .git .pytest_cache
44
testpaths = datastream
5-
addopts = --doctest-modules
5+
addopts = --doctest-modules

0 commit comments

Comments
 (0)