@@ -26,7 +26,7 @@ Now you might be wondering why another library when there are already a few impl
2626* The implementation achieves 100% test coverage.
2727* It follows Pythonic principles, resulting in clean and readable code.
2828* It adds some cool innovative features such as conditions or error handling and an even more declarative look.
29- * It provides loaders for various data sources such as CSV, JSON and XML files.
29+ * It provides loaders for various data sources such as CSV, JSON, XML and YAML files.
3030
3131Let's take a look at a small example:
3232
@@ -213,15 +213,15 @@ Stream.concat(Stream.of([1, 2]), Stream.of([3, 4]))
213213
214214Creates a new Stream from multiple Streams. Order doesn't change.
215215
216- ## Use loaders: Load data from CSV, JSON and XML files in just one line
216+ ## Use loaders: Load data from CSV, JSON, XML and YAML files in just one line
217217
218- PyStreamAPI offers a convenient way to load data from CSV, JSON and XML files. Like that you can start processing your
218+ PyStreamAPI offers a convenient way to load data from CSV, JSON, XML and YAML files. Like that you can start processing your
219219files right away without having to worry about reading and parsing the files.
220220
221221You can import the loaders with:
222222
223223``` python
224- from pystreamapi.loaders import csv, json, xml
224+ from pystreamapi.loaders import csv, json, xml, yaml
225225```
226226Now you can use the loaders directly when creating your Stream:
227227
@@ -253,14 +253,30 @@ pip install streams.py[xml_loader]
253253Afterward, you can use the XML loader like this:
254254
255255``` python
256- Stream.of(xml(" data.xml" ))
257- .map(lambda x : x.attr1)
256+ Stream.of(xml(" data.xml" )) \
257+ .map(lambda x : x.attr1) \
258258 .for_each(print )
259259```
260260
261261The access to the attributes is using a node path syntax. For more details on how to use the node path syntax, please
262262refer to the [ documentation] ( https://pystreamapi.pickwicksoft.org/reference/data-loaders ) .
263263
264+ For YAML:
265+
266+ In order to use the YAML loader, you need to install the optional yaml dependency:
267+
268+ ``` bash
269+ pip install streams.py[yaml_loader]
270+ ```
271+
272+ Afterward, you can use the YAML loader like this:
273+
274+ ``` python
275+ Stream.of(yaml(" data.yaml" )) \
276+ .map(lambda x : x.attr1) \
277+ .for_each(print )
278+ ```
279+
264280## API Reference
265281For a more detailed documentation view the docs on GitBook: [ PyStreamAPI Docs] ( https://pystreamapi.pickwicksoft.org/ )
266282
0 commit comments