Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DataFrame_Groupby.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__author__ = 'Who ?'
__author__ = 'Kevin'

import pandas as pd
import numpy as np
Expand Down Expand Up @@ -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])
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__ = 'Louis'

import pandas as pd
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion Example_MovieLens.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__author__ = 'Who ?'
__author__ = 'Luciana'

import pandas as pd

Expand Down Expand Up @@ -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])

2 changes: 1 addition & 1 deletion Series_vs_DataFrame.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
__author__ = 'Who ?'
__author__ = 'Mathieu'

import pandas as pd

Expand Down