from_df fails with std::bad_cast on a reversed DataFrame mixing string and float columns
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 66/100
Rechercherichtung
Start by reading the Python DataFrame registration path used by DuckDBPyConnection.from_df and the replacement scan, then look for tests covering reversed pandas views and mixed column types. Reproduce with the issue's two-column example and compare it with the copied frame. Done when both entry points handle the negative-stride view and a regression test verifies the result.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What happens?
DuckDBPyConnection.from_df (and a replacement scan of the same frame) fails on a DataFrame that is a negative-stride view, such as df.iloc[::-1], when it mixes a string (object or str) column with a float column. On 2.0.0 the error is std::bad_cast; on 1.3.2 and 1.5.6 it is Unable to cast Python instance of type <class 'int'> to C++ type '?'.
A copy of the same view (df.iloc[::-1].copy()) works, and so does a reversed frame with a single column, or with only string columns.
To Reproduce
import duckdb
import pandas as pd
df = pd.DataFrame({"a": ["x", "y"], "b": [1.0, 2.0]})
duckdb.connect().from_df(df.iloc[::-1]).fetchall()
# duckdb.Error: std::bad_cast
duckdb.connect().from_df(df.iloc[::-1].copy()).fetchall()
# [('y', 2.0), ('x', 1.0)]
| DuckDB | pandas | result |
|---|---|---|
| 2.0.0 | 3.1.1 | std::bad_cast |
| 2.0.0 | 2.3.3 | std::bad_cast |
| 1.5.6 | 3.1.1 | Unable to cast Python instance of type <class 'int'> to C++ type '?' |
| 1.3.2 | 2.3.3 | Unable to cast Python instance of type <class 'int'> to C++ type '?' |
OS:
Linux x86_64 (Pop!_OS, kernel 7.2)
DuckDB Package Version:
2.0.0
Python Version:
3.13.2
Full Name:
Jonas Hörsch
Affiliation:
Open Energy Transition
What is the latest build you tested with?
2.0.0 from PyPI (latest release)
Did you include all relevant data sets for reproducing the issue?
Not applicable: the reproduction creates its own data.
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration to reproduce the issue?
- Yes, I have
- Vorherrschende Sprache
- Python
- Sterne
- 203
- Forks
- 124
- Ø Merge
- 13 Std. 36 Min.
- Gemergte PRs (30 T.)
- 61
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus duckdb/duckdb-python
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.Evtl. vergeben @aleks-drozy hat das vor 97 Tagen übernommen. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
duckdb/duckdb-python#576 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet functionEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
duckdb/duckdb-python#386 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
duckdb/duckdb-python#736 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs triage
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
duckdb/duckdb-python#733 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
nanobind: leaked ... when a DuckDB type is referenced in overload signature and numpy is importedOffenneeds triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
duckdb/duckdb-python#732 · 5 Kommentare · 3 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in duckdb/duckdb-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
aws-samples/sample-per-model-bedrock#795 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
Pretalx reports older version to be the latest release than what is actually installed and availableOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
micropython/micropython#19906 ·
Maintainer antworten meist innerhalb von 1 Tag