fix(dataframe): Korrektheit & Politur für sclass.DataFrame (PR1)#51
Merged
Conversation
Behebt bestätigte Bugs und politurt die selbstbeschreibende DataFrame-Klasse, strikt rückwärtskompatibel (load-bearing API unverändert), 100 % Coverage. - Mutable Default behoben: df=None statt geteiltem pd.DataFrame()-Objekt; neue Instanzen ohne df teilen kein gemeinsames DataFrame mehr. - to_dataframe(): Tippfehler-Key "!sdata" -> "_sdata" und column_metadata mit eingebettet (konsistent zu to_parquet); so eingebettete Metadaten sind beim Lesen wieder sichtbar. - Nackte except: durch getypte, geloggte Restore-Pfade ersetzt; gemeinsamer Helfer _restore_from_attrs() dedupliziert from_parquet/from_parquet_bytes und ist robust gegen None/leere attrs. Sinnloses try/except: raise entfernt. - from_parquet wirft FileNotFoundError statt nacktem Exception. - column_metadata<->Spalten: Waisen-Keys werden im __init__ per warning gemeldet (nicht-brechend); Docstring entsprechend ehrlich gemacht. - engine als konsistentes kwarg in to_dict/from_dict (Default pyarrow). - Klare Fehlermeldung ohne Parquet-Backend via _require_parquet() (Hinweis auf pip install sdata[parquet]). - Veraltete Docstrings korrigiert (Blob/lazy/Dict/param-name). - Convenience-Durchreichen: __len__, shape, columns, dtypes, head(), describe(), __repr__ (delegieren an das innere pandas-DataFrame). - Tests: Bugfix-Regressionen + Convenience in test_sclass_dataframe_correctness.py; test_to_dataframe_attrs auf _sdata aktualisiert (pinnte zuvor den Bug).
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Documentation | 5 minor |
| Security | 24 high |
🟢 Metrics 14 complexity · 0 duplication
Metric Results Complexity 14 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This was referenced Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Erster von vier PRs zur Verbesserung von
sdata/sclass/dataframe.py— Korrektheit & Politur. Strikt rückwärtskompatibel (alle load-bearing Namen/Signaturen erhalten), lokale CI grün, 100 % Coverage.Behobene Bugs
df: Optional[pd.DataFrame] = pd.DataFrame()→ alle ohnedferzeugten Instanzen teilten dasselbe Objekt. Jetztdf=None+ eigenes leeres DataFrame pro Instanz.to_dataframe()Tippfehler: bettete unter"!sdata"ein (alle anderen Pfade nutzen"_sdata"), wodurch die Metadaten beim Lesen unsichtbar waren. Jetzt"_sdata"inkl.column_metadata.except:(6×) → getypte, geloggte Restore-Pfade über den gemeinsamen Helfer_restore_from_attrs()(robust gegenNone/leer). Sinnlosestry/except Exception: raiseentfernt.from_parquetwirft jetztFileNotFoundErrorstatt nacktemException.Politur
column_metadata↔Spalten: Waisen-Keys werden im__init__perlogger.warninggemeldet (nicht-brechend); Docstring ehrlich gemacht (vorher fälschlichValueErrorversprochen).engineals konsistentes kwarg into_dict/from_dict(Defaultpyarrow)._require_parquet()(Hinweis aufpip install sdata[parquet]).:return: Dict/Parameter-Name).__len__,shape,columns,dtypes,head(),describe(),__repr__.Tests
tests/test_sclass_dataframe_correctness.py(Mutable-Default getrennt,_sdata-Key, getypte Restore-Pfade, Waisen-Warnung,_require_parquet-Fehlerpfad, Convenience).test_to_dataframe_attrsauf_sdataaktualisiert (pinnte zuvor den Bug).Lokale CI grün (
ci/local-ci.sh),dataframe.pyund Projekt-Total = 100 % (476 passed, 9 optionale Skips).