Repository: zincware/ZnTrack

Issue:
zn.plots: set index.name automatically if not set
Raise error if dependency has no outputs duplicate of #137 

zn.plots: set index.name automatically if not set

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware) Report
> Merging [#271](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware) (3a49fd7) into [main](https://codecov.io/gh/zincware/ZnTrack/commit/5e3fdff8b4c60831910efd12a37c1d00d2b2284e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware) (5e3fdff) will **not change** coverage.
> The diff coverage is `0.00%`.

> :exclamation: Current head 3a49fd7 differs from pull request most recent head 0d2a4cd. Consider uploading reports for the commit 0d2a4cd to get more accurate results

```diff
@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   72.06%   72.06%           
=======================================
  Files          26       26           
  Lines        1149     1149           
  Branches      226      226           
=======================================
  Hits          828      828           
  Misses        295      295           
  Partials       26       26           
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `72.06% <0.00%> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware) | Coverage Δ | |
|---|---|---|
| [zntrack/zn/plots.py](https://codecov.io/gh/zincware/ZnTrack/pull/271/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware#diff-em50cmFjay96bi9wbG90cy5weQ==) | `68.00% <0.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware). Last update [5e3fdff...0d2a4cd](https://codecov.io/gh/zincware/ZnTrack/pull/271?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zincware).


Patch:
diff --git a/zntrack/zn/plots.py b/zntrack/zn/plots.py
index f65dfac..32090a7 100644
--- a/zntrack/zn/plots.py
+++ b/zntrack/zn/plots.py
@@ -30,10 +30,7 @@ class plots(ZnTrackOption):
             )
 
         if value.index.name is None:
-            raise ValueError(
-                "pd.DataFrame must have an index name! You can set the name via"
-                " DataFrame.index.name = <index name>."
-            )
+            value.index.name = "index"
 
         file = self.get_filename(instance)
         file.parent.mkdir(exist_ok=True, parents=True)


Test patch:
diff --git a/tests/integration_tests/test_zn_plots.py b/tests/integration_tests/test_zn_plots.py
index fa7b03d..9ba0384 100644
--- a/tests/integration_tests/test_zn_plots.py
+++ b/tests/integration_tests/test_zn_plots.py
@@ -23,7 +23,7 @@ class WritePlots(Node):
 
     def run(self):
         self.plots = pd.DataFrame({"value": [x for x in range(100)]})
-        self.plots.index.name = "index"
+        self.plots.index.name = "my_index"
 
 
 class WritePlotsNoIndex(Node):
@@ -44,6 +44,9 @@ def test_write_plots(proj_path):
     WritePlots().write_graph(no_exec=False)
     subprocess.check_call(["dvc", "plots", "show"])
 
+    wp = WritePlots.load()
+    assert wp.plots.index.name == "my_index"
+
 
 def test_load_plots(proj_path):
     WritePlots().run_and_save()
@@ -55,8 +58,9 @@ def test_load_plots(proj_path):
 
 
 def test_write_plots_value_error(proj_path):
-    with pytest.raises(ValueError):
-        WritePlotsNoIndex().run_and_save()
+    WritePlotsNoIndex().run_and_save()
+    wpni = WritePlotsNoIndex.load()
+    assert wpni.plots.index.name == "index"
 
 
 def test_write_plots_type_error(proj_path):