from_df fails with std::bad_cast on a reversed DataFrame mixing string and float columns
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 66/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 203
- Forks
- 124
- Merge medio
- 13 h 36 min
- PR fusionados (30 d)
- 61
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de duckdb/duckdb-python
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.Posiblemente ocupada @aleks-drozy la tomó hace 95 días. Abiertoneeds triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
duckdb/duckdb-python#576 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet functionPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoneeds triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
duckdb/duckdb-python#386 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
duckdb/duckdb-python#736 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
duckdb/duckdb-python#733 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
nanobind: leaked ... when a DuckDB type is referenced in overload signature and numpy is importedAbiertoneeds triage
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
duckdb/duckdb-python#732 · 5 comentarios · 3 reacciones ·
Los mantenedores suelen responder en 1 día
Todos los issues de duckdb/duckdb-python
Issues similares
-
area/test type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Clodmony/starship-coop#70 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
jumpserver/jumpserver#17980 ·
Los mantenedores suelen responder en 1 día
-
community enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Claiming namespace `prodmetrics`Abiertonamespace
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
EclipseFdn/open-vsx.org#15341 ·
Los mantenedores suelen responder en 1 día