diff --git a/DataFrame_Groupby.py b/DataFrame_Groupby.py index 19e2346..6a437e6 100644 --- a/DataFrame_Groupby.py +++ b/DataFrame_Groupby.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__author__ = 'Who ?' +__author__ = 'Kevin' import pandas as pd import numpy as np @@ -59,7 +59,7 @@ 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) +Hamtaro = cloneDF(mergeRatings) +Hamtaro = sortRatingsField.groupby(['movie_id', 'title'])['rating'].agg( + {'COUNT': np.size, 'myAVG': lambda x: x.sum() / float(x.count())}).sort_values('COUNT', ascending=False) print('My info sorted: \n%s' % sortRatingsField[:15]) diff --git a/DataFrame_pivot_table.py b/DataFrame_pivot_table.py index 16b2570..82ebf32 100644 --- a/DataFrame_pivot_table.py +++ b/DataFrame_pivot_table.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__author__ = 'Who ?' +__author__ = 'Louis' import pandas as pd import numpy as np diff --git a/Example_MovieLens.py b/Example_MovieLens.py index 3f26fdb..a52e415 100644 --- a/Example_MovieLens.py +++ b/Example_MovieLens.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__author__ = 'Who ?' +__author__ = 'Luciana' import pandas as pd @@ -46,3 +46,4 @@ # Example 4: show specific columns ratings_info = merge_ratings[['user_id', 'title', 'rating']] print('Show specific columns: \n%s' % ratings_info[:10]) + diff --git a/Series_vs_DataFrame.py b/Series_vs_DataFrame.py index a81cb51..c188e08 100644 --- a/Series_vs_DataFrame.py +++ b/Series_vs_DataFrame.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__author__ = 'Who ?' +__author__ = 'Mathieu' import pandas as pd