-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query with column_formats
set on FixedString columns should convert to pandas.StringDtype
#356
Comments
Have you tried setting the read format for the column to string? https://clickhouse.com/docs/en/integrations/python#read-formats I'm not sure that will work without a code change but it's worth testing. |
The simple example in the description uses read formats with from clickhouse_connect.datatypes.format import set_read_format
set_read_format('FixedString', 'string')
# client = get_client()
df = client.query_df("select * from test_string") this gives the same |
Ah, I missed that, the column level should be good enough. I'll try to push a fix in the next day or two. |
I actually can't reproduce this. What Pandas version are you using? |
This should be fixed in 0.7.12 if you want to validate. I did manage to recreate the issue (I think), although pandas was reporting weird data types in my tests. |
Describe the bug
When a table has
FixedString
type columns,query_df
method can use read formats parameter to convert it to string in the returned dataframe. However, unlike other returned String columns which are converted to PandasStringDType
,FixedString
columns are converted toobject
dtype. This makes the returned string columns have inconsistent types and behaviors.Reference: https://pandas.pydata.org/docs/user_guide/text.html
Steps to reproduce
Expected behaviour
As shown above, the returned String columns
name
andcity
have Pandas StringDType type, while the FixedString columnsex
is converted to object dtype. It's expected thesex
column is also converted to Pandas StringDType.Configuration
Environment
ClickHouse server
The text was updated successfully, but these errors were encountered: