Skip to content

Commit 2a3c548

Browse files
committed
have diffable ignore output of value_counts()
1 parent 2eab6cd commit 2a3c548

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"editor.formatOnSave": false
77
},
88
"workbench.externalBrowser": "chrome",
9-
"editor.formatOnSave": false
9+
"editor.formatOnSave": false,
10+
"flake8.enabled": false
1011
}

extras/lib/diffable.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,24 @@ def has_memory_address(cell: NotebookNode):
2828
)
2929

3030

31+
def is_value_count(source: str):
32+
return ".value_counts(" in source
33+
34+
3135
def should_clear_output(cell: NotebookNode):
32-
"""Ignore any system command output, since things like package paths shown in warnings/errors can change between different systems. Also clear HTML output, since it often has generated IDs (from displacy, plotly, etc.) that change with each execution."""
36+
"""
37+
Ignore:
38+
- Any system command output, since things like package paths shown in warnings/errors can change between different systems
39+
- HTML output, since it often has generated IDs (from displacy, plotly, etc.) that change with each execution
40+
- `value_counts()` output, since the order of the index seems to differ by machine/OS
41+
"""
42+
3343
source = cell["source"]
3444
return (
35-
is_system_command(source) or has_rich_output(cell) or has_memory_address(cell)
45+
is_system_command(source)
46+
or has_rich_output(cell)
47+
or has_memory_address(cell)
48+
or is_value_count(source)
3649
)
3750

3851

0 commit comments

Comments
 (0)