I have the following code in SQL: I’ve been trying to rewrite it in python like so: but I keep getting a generic error message. What am I doing wrong? EDIT: added the error message Answer IIUC, you could try the following: The equivalent of SELECT DISTINCT col is drop_duplicates(col) and the equivalent …
Tag: pandas-groupby
Is there a way to run posqresql queries in a pandas dataframe?
I have pandas dataframe like this : created_at lat long hex_ID 0 2020-10-13 15:12:18.682905 28.690628 77.323285 883da1ab0bfffff 1 2020-10-12 22:49:05.886170 28.755408 77.112289 883da18e87fffff 2 2020-10-13 15:24:17.692375 28.690571 77.323335 883da1ab0bfffff 3 2020-10-12 23:21:13.700226 28.589922 77.082738 883…
Convert SAS proc sql to Python(pandas)
I rewrite some code from SAS to Python using Pandas library. I’ve got such code, and I have no idea what should I do with it? Can you help me, beacase its too complicated for me to do it correct. I’ve changed the name of columns (for encrypt sensitive data) This is SAS code: This is my try in Pand…
Pandas dataframe combine unique row values
I have a dataframe like the following with over 90000 rows. As you can see, some origin and destination values repeat for example there are multiple rows where origin=101011001, destination=101011002. My goal is to group the repeating origin and destination values and sum the the people column, so the datafra…