Open Katiii opened 1 year ago
Looks like the problem is not with LowCardinality
itself, but with the Pandas category
data type. It is not mapped to numpy
types and crashes when trying to transform it.
To Reproduce
import os
import pandas as pd
from clickhouse_driver import Client
def main():
client = Client(
host=os.environ["HOST"],
user=os.environ["USER"],
password=os.environ["PASSWORD"],
)
client.execute("""
CREATE TEMPORARY TABLE test
(
column1 String
)
engine = Null
""")
df = pd.DataFrame([["value1"]], columns=["column1"], dtype="category")
client.insert_dataframe(
query=f"INSERT INTO test VALUES",
dataframe=df,
settings={"use_numpy": True},
)
if __name__ == "__main__":
main()
Versions
Describe the bug There is no way to use constant 'use_numpy' client settings for loading and inserting columns with LowCardinality(String) type
To Reproduce On the one side
On the other side
Works and returns 3
Expected behavior No errors, exceptions and correct getting and inserting pandas.DataFrame
Versions