Skip to content

Modif #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions DataFrame_Groupby.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
__author__ = 'Who ?'

__author__ = 'Floflo c'est le plus beau'


import pandas as pd
import numpy as np
Expand Down Expand Up @@ -62,5 +63,5 @@ def cloneDF(df):
# Sort data ratings by created field (groupby + lambda function + sorted)
sortRatingsField = cloneDF(mergeRatings)
sortRatingsField = sortRatingsField.groupby(['movie_id', 'title'])['rating'].agg(
COUNT=np.size, myAVG=lambda x: x.sum() / float(x.count())).sort('COUNT', ascending=False)
COUNT=np.size, myAVG=lambda x: x.sum() / float(x.count())).sort_values ('COUNT', ascending=False)
print('My info sorted: \n%s' % sortRatingsField[:15])
2 changes: 1 addition & 1 deletion DataFrame_pivot_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__author__ = 'Who ?'
__author__ = 'Hanaell'

import pandas as pd
import numpy as np
Expand Down