amphi-ai / amphi-etl

Low-code ETL for structured and unstructured data. Generates Python code you can deploy anywhere.
https://docs.amphi.ai
Other
551 stars 12 forks source link

Filter Rows : how to force numeric value #38

Closed amoradell closed 6 days ago

amoradell commented 1 week ago

I want to filter rows based on a numeric field

I have declared :

aggregate1 = sqlQuery1.groupby(["CODPOSTAL",]).agg(VILLE_count=('VILLE', 'count'), VILLE_min=('VILLE', 'min'), VILLE_max=('VILLE', 'max')).reset_index()
# Filter rows based on condition
filter2 = aggregate1.query("VILLE_count > '1'")

I got error : TypeError: Invalid comparison between dtype=int64 and str

I have boolean option "Enforce value as string" Is it possible to have "Enforce value as number" ?

To fix temporary, I add a string TypeConverter on VILLE_count between aggregate1 and filter2 Very easy :)

tgourdel commented 1 week ago

Thanks @amoradell, actually when specifying a number in the value, it should automatically consider it as a number. That is why there was only the "Enforce value as string" option. It looks like there is a miss here! I'll take a look. Thank you for reporting 🙏

tgourdel commented 6 days ago

It's been fixed in 0.4.7! Thank you for reporting pip install --upgrade --force-reinstall amphi-etl