amphi-ai / amphi-etl

Python-based Low-code ETL for data manipulation and transformation. Generates Python code you can deploy anywhere.

Home Page:https://amphi.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter Rows : how to force numeric value

amoradell opened this issue · comments

I want to filter rows based on a numeric field

I have declared :

  • Column name = VILLE_count
  • Condition = >
  • Value = 1
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 :)

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 🙏

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