Skip to content

Converting from pandas with non-string columns can drop columns #437

Description

@FBruzzesi

What happens?

When converting from a pandas DataFrame that has non-string columns (allowed in pandas), if the pair 1 and True and/ the pair 0 and False are present, then:

  1. The first appearing column name of the pair is maintained
  2. The latter appearing column values of the pair is maintained

To Reproduce

import duckdb
import pandas as pd

_df = pd.DataFrame({
    1: [0, 1],
    True: ["x", "y"],
    False: [4.2, 3.14],
    0: [True, False]
})
rel = duckdb.sql("select * from _df")

rel.columns
# ['1', 'False']

rel
┌─────────┬─────────┐
│    1False  │
│ varcharboolean │
├─────────┼─────────┤
│ xtrue    │
│ yfalse   │
└─────────┴─────────┘

OS:

Compiler: Clang 22.1.1 ; OS: Darwin ; Release : 25.4.0 ; Machine : arm64 ; Processor : arm

DuckDB Package Version:

1.5.2

Python Version:

3.13.12

Full Name:

Francesco Bruzzesi

Affiliation:

narwhals-dev

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions