-
Create constant column in dataframe
df['name_of_new_column'] = 10
http://stackoverflow.com/questions/24039023/add-column-with-constant-value-to-pandas-dataframe
-
Aggregate using multiple columns.
def my_function(group): return group['first_column'].sum()/group['second_column'].sum() df.groupby(keys).apply(my_function)
Last active
October 3, 2015 20:48
-
-
Save rocarvaj/072c7d71381b65974b91 to your computer and use it in GitHub Desktop.
Things that I've learned about Pandas but that weren't easy to find (for me at least)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment