Last active
April 23, 2022 17:52
-
-
Save mepsrajput/c1551455befe813cc20f14653fe7e8d5 to your computer and use it in GitHub Desktop.
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
from IPython.display import display | |
def multiFreq(dataset, variable_list): | |
for i in variable_list: | |
datax = dataset[f'{i}'].value_counts() | |
datay = pd.DataFrame({ | |
f'{i}': datax.index, | |
'Frequency': datax.values, | |
'Percent': ((datax.values/datax.values.sum())*100).round(2), | |
'Cumulative Frequency': datax.values.cumsum(), | |
'Cumulative Percent': ((datax.values.cumsum()/datax.values.sum())*100).round(2) | |
}) | |
display(datay) | |
multiFreq(data, ['GENRE', 'MOVIE']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment