Last active
March 23, 2019 12:56
-
-
Save hujuu/c449de2d310842ba697fd235ce75c69c to your computer and use it in GitHub Desktop.
pandasでgroupbyしたところにapplyして使う用の関数です
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dup(df, columns=['columns_name']): | |
return df.duplicated(subset=columns) | |
def dup_count(df, columns=['columns_name']): | |
return df.duplicated(subset=columns).value_counts() | |
def vcount(df): | |
return df.value_counts() | |
def count(df): | |
return df.count() | |
def count_max(df): | |
return df.value_counts().max() | |
def diff(df): | |
return df.count() - df.value_counts().max() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment