Skip to content

Commit 96badc7

Browse files
committed
Updating docs
1 parent 56cc461 commit 96badc7

File tree

6 files changed

+78
-1
lines changed

6 files changed

+78
-1
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ Authors in order of the timeline of their contributions:
5858
- [kor4ik](https://github.com/kor4ik) for the bugfix for `include_paths` for nested dictionaries.
5959
- [martin-kokos](https://github.com/martin-kokos) for using tomli and tomli-w for dealing with tomli files.
6060
- [Alex Sauer-Budge](https://github.com/amsb) for the bugfix for `datetime.date`.
61+
- [William Jamieson](https://github.com/WilliamJamieson) for [NumPy 2.0 compatibility](https://github.com/seperman/deepdiff/pull/422)

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Tested on Python 3.7+ and PyPy3.
2323

2424
Please check the [ChangeLog](CHANGELOG.md) file for the detailed information.
2525

26+
DeepDiff 6-6-0
27+
28+
- [Serialize To Flat Dicts]()
29+
- [NumPy 2.0 compatibility](https://github.com/seperman/deepdiff/pull/422) by [William Jamieson](https://github.com/WilliamJamieson)
30+
2631
DeepDiff 6-5-0
2732

2833
- [parse_path](https://zepworks.com/deepdiff/current/faq.html#q-how-do-i-parse-deepdiff-result-paths)
@@ -66,10 +71,21 @@ Install optional packages:
6671

6772
Please take a look at the [CHANGELOG](CHANGELOG.md) file.
6873

74+
# 🛠️ Detect And Clean Messy Data In Transit
75+
76+
If you deal with messy data, check out [Qluster](https://qluster.ai/solution), another tool by the creator of DeepDiff.
77+
78+
*Qluster's mission is to enable users to create adaptive data pipelines that detect issues, quarantine bad data, and enable the user to fix data issues via a spreadsheet UI.*
79+
80+
6981
# Survey
7082

7183
:mega: **Please fill out our [fast 5-question survey](https://forms.gle/E6qXexcgjoKnSzjB8)** so that we can learn how & why you use DeepDiff, and what improvements we should make. Thank you! :dancers:
7284

85+
# Data Cleaning
86+
87+
88+
7389

7490
# Contribute
7591

docs/authors.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Authors in order of the timeline of their contributions:
8383
and tomli-w for dealing with tomli files.
8484
- `Alex Sauer-Budge <https://github.com/amsb>`__ for the bugfix for
8585
``datetime.date``.
86+
- `William Jamieson <https://github.com/WilliamJamieson>`__ for `NumPy 2.0
87+
compatibility <https://github.com/seperman/deepdiff/pull/422>`__
8688

8789
.. _Sep Dehpour (Seperman): http://www.zepworks.com
8890
.. _Victor Hahn Castell: http://hahncastell.de

docs/delta.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ Delta Serializer
208208

209209
DeepDiff uses pickle to serialize delta objects by default. Please take a look at the :ref:`delta_deserializer_label` for more information.
210210

211+
212+
.. _to_flat_dicts:
213+
214+
Delta Serialize To Flat Dictionaries
215+
------------------------------------
216+
217+
Read about :ref:`delta_to_flat_dicts_label`
218+
211219
.. _delta_dump_safety_label:
212220

213221
Delta Dump Safety
@@ -472,7 +480,7 @@ Unable to get the item at root['x']['y'][3]: 'x'
472480
Unable to get the item at root['q']['t']
473481
{}
474482

475-
# Once we set the force to be True
483+
Once we set the force to be True
476484

477485
>>> delta = Delta(diff, force=True)
478486
>>> {} + delta

docs/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ The DeepDiff library includes the following modules:
3131
What Is New
3232
***********
3333

34+
DeepDiff 6-6-0
35+
--------------
36+
37+
- :ref:`delta_to_flat_dicts_label` can be used to serialize delta objects into a flat list of dictionaries.
38+
- `NumPy 2.0 compatibility <https://github.com/seperman/deepdiff/pull/422>`__ by `William Jamieson <https://github.com/WilliamJamieson>`__
39+
3440
DeepDiff 6-5-0
3541
--------------
3642

docs/serialization.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,48 @@ From Json Pickle
105105
Load the diff object from the json pickle dump.
106106
Take a look at the above :ref:`to_json_pickle_label` for an example.
107107

108+
109+
.. _delta_to_flat_dicts_label:
110+
111+
Delta Serialize To Flat Dictionaries
112+
------------------------------------
113+
114+
Sometimes, it is desired to serialize a :ref:`delta_label` object to a list of flat dictionaries. For example, to store them in relation databases. In that case, you can use the Delta.to_flat_dicts to achieve the desired outcome.
115+
116+
For example:
117+
118+
>>> from pprint import pprint
119+
>>> from deepdiff import DeepDiff, Delta
120+
>>> t1 = {"key1": "value1"}
121+
>>> t2 = {"field2": {"key2": "value2"}}
122+
>>> diff = DeepDiff(t1, t2, verbose_level=2)
123+
>>> pprint(diff, indent=2)
124+
{ 'dictionary_item_added': {"root['field2']": {'key2': 'value2'}},
125+
'dictionary_item_removed': {"root['key1']": 'value1'}}
126+
>>>
127+
>>> delta = Delta(diff, verify_symmetry=True)
128+
>>> flat_dicts = delta.to_flat_dicts()
129+
>>> pprint(flat_dicts, indent=2)
130+
[ { 'action': 'dictionary_item_added',
131+
'path': ['field2', 'key2'],
132+
'value': 'value2'},
133+
{'action': 'dictionary_item_removed', 'path': ['key1'], 'value': 'value1'}]
134+
135+
136+
Example 2:
137+
138+
>>> t3 = ["A", "B"]
139+
>>> t4 = ["A", "B", "C", "D"]
140+
>>> diff = DeepDiff(t3, t4, verbose_level=2)
141+
>>> pprint(diff, indent=2)
142+
{'iterable_item_added': {'root[2]': 'C', 'root[3]': 'D'}}
143+
>>>
144+
>>> delta = Delta(diff, verify_symmetry=True)
145+
>>> flat_dicts = delta.to_flat_dicts()
146+
>>> pprint(flat_dicts, indent=2)
147+
[ {'action': 'iterable_item_added', 'path': [2], 'value': 'C'},
148+
{'action': 'iterable_item_added', 'path': [3], 'value': 'D'}]
149+
150+
151+
108152
Back to :doc:`/index`

0 commit comments

Comments
 (0)