Posts

Showing posts from January, 2019
'Sum' with Groupby() on a column in pandas. ====================================================== When we use aggregation function 'sum' on the result of groupby() on a column as below. x_df.groupby(['Column1']).sum() If there are multiple columns in data frame x_df. Only those columns will come in the result which are of type "float". If there are columns, where type of elements are of type "int", it will not come in the result if above code. Check the type of elements of columns if any column is not coming in the result.
when we use "apply" with a custom function with "groupby" on a pandas data frame. the customer function inside the apply() gets called twice. this is by design of pandas. Issue in the pandas. https://github.com/pandas-dev/pandas/issues/2656 My question related to this issue on stackoverflow, https://stackoverflow.com/questions/53698605/all-columns-are-not-passed-when-we-use-apply-on-result-of-groupby-with-a-custom