How do I transform this SQL code:
SELECT
COUNT(DISTINCT DATEn) as count (*)
FROM weather_data
WHERE cast (rain as integer) = 1
using the Pandas notation, like this: df.groupby ('rain') DATEn.sum ()
How do I transform this SQL code:
SELECT
COUNT(DISTINCT DATEn) as count (*)
FROM weather_data
WHERE cast (rain as integer) = 1
using the Pandas notation, like this: df.groupby ('rain') DATEn.sum ()
IIUC:
df.loc[pd.to_numeric(df['rain'], errors='coerce') == 1, 'DATEn'].nunique()