Read My code then scroll down to read the solution book code (pasted as screenshot) and tell me if i was different anywhere.
Then look at the error message i get from my code (code same as solution) and tell me if u did not feel like u got pranked, because I surely did.
Is there some reading between the lines here on DQ that I have been missing since 2018, that I have been falling steep for this non-trick every time?
My Code:
reviews_max = {}
duplicate_apps = {}
for app in google_store[1:]:
name = app[0]
n_reviews = float(app[3])
if name in reviews_max:
if reviews_max[name] < n_reviews:
reviews_max[name] = n_reviews
elif name not in reviews_max:
reviews_max[name] = n_reviews
print(reviews_max)
#print(duplicate_apps)
What I expected to happen:
I expect the state of dataset/csv provided to us at this point to be devoid of dirty data or the assignment error checker should not check for strings vs int type issue so that i can pass the assignment, else there should be a clear notice to clean the file before doing this Part 2 of project and that the range of bad characters to be provided (there is no way i can dream abt it before hand nor can i risk of changing anything in dataset before being instructed for because you never know if the next part of project might require having the same changes being NOT DONE)
What actually happened:
ended up putting a precious half an hour towards no use, EXACTLY in the manner I described in my previous post/topic abt another assessment/lesson in python where the “language was completely from mars but i was still on earth”. The question/task described in the instructions pane was clearly mis-leading trying to make me think that i am doing something wrong (i clearly wasnt because now my code and solution book literally have same code minus one line). I did not get or obtain anything out of this by putting half an hour into something which led me no-where. I promise i haven’t messed with the actual data provided us ever before or now or today.
Nor do previous parts of the guided project ask me or mention about cleaning other columns (or for that matter entire dataset, in which case there is no point of doing this project because the project itself is literally about cleaning and analyzing the dataset)
The Error I Get Is As Follows :-
(this shows the dataset available was not fit for direct implementation of this “PART TWO” part of the project.)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-78-cff677cf5178> in <module>
15 for app in google_store:
16 name = app[0]
---> 17 n_reviews = float(app[3])
18
19 if name in reviews_max and reviews_max[name] < n_reviews:
ValueError: could not convert string to float: '3.0M'
The Solution Given In The Solution Book Is EXACTLY LIKE MY CODE. And They Show The Same Articulation.
If That Is So, Then How Am I Getting Error ?
screenshot of solution book : -
Has anyone else posted this question before? I would have researched for this question if I wouldn’t have had to spend my valuable half hour behind wrong thinking. But now that i lost my time and cant afford to put more towards searching for it thoroughly, I need help if anyone was in same situation before and if yes, what keywords did they use in search-box to get to this topic?
I tried searching for this for about 5 mins but I failed because the search-results, result in plethora of ‘results’ displayed in slightly odd (titled) manner making it difficult for me to guess which one might be talking about my situation. I do not have several hours to click on each question and read them like a course-book.
when I click on community discussion, I land in a GENERAL PAGE and not the page specific to this PART TWO or Chapter 5 of Guided Project. (which kind of defeats the purpose of the community discussion button feature as well)