# Solving **Python Data Analysis Basics** Practice Problems 5 with Pandas DataFrames - Help! [1000331-5]

I tried to solve Python Data Analysis Basics Practice Problem 5 with DataFrames, which returned approximate values.

Learn data science with Python and R projects)

My Code:

``````import csv
games = raw[1:]

# convert list to DataFrame

import pandas as pd

genre_list = df['Genre'].unique()

# Define a function to find the sum of a column for a given genre.

def find_most(genre,column):
#retrieve values for the target genre
genre_sales = df[df['Genre']==genre][column]
#convert these values to float
genre_sales = genre_sales.astype(float)
#reutrn sum of values for the genre
return genre_sales.sum()

global_sales_per_genre = {genre:find_most(genre,'Global_Sales') for genre in genre_list}

``````

What I expected to happen:
Correct values:

``````{'Misc': 809.9599999999969,
'Simulation': 392.19999999999965,
'Action': 1751.1799999999835,
'Role-Playing': 927.369999999997,
'Sports': 1330.9299999999942,
'Racing': 732.0399999999973,
'Puzzle': 244.95000000000005,
'Fighting': 448.91000000000014,
'Strategy': 175.12000000000018,
'Platform': 831.3699999999982,
'Shooter': 1037.3699999999963,
``````

What actually happened:

actual values

`````` {'Misc': 809.96,
'Simulation': 392.2,
'Action': 1751.1799999999998,
'Role-Playing': 927.37,
'Sports': 1330.93,
'Racing': 732.04,
'Puzzle': 244.95,
'Fighting': 448.90999999999997,
'Strategy': 175.12,
'Platform': 831.37,
'Shooter': 1037.37,