Hi there,
I do not know what’s wrong with my code here:
Thanks,
Lloyd
Hello @lloyd.vince,
Could you check in process_metadata
function you correctly assign the sales rank and category from the salesRank
column into two new columns: sales_category
as key and sales_rank
as value:
df_rank = pd.DataFrame([{"sales_category": key, "sales_rank": value} for d in tmp_df["salesRank"].tolist() for key, value in d.items()])
If you use sales_category
as value instead of key you will get this error since it is not in text form. Hope it helps
[quote=“Georgios, post:2, topic:795045”]
If you use sales_category
as value instead of key you will get this error since it is not in text form.
[/quote]
Hi Georgios,
Thanks for your reply. My code correctly assigns those values. Thank you
Hello @lloyd.vince,
Yes I figured since there is a green checkmark under your cell and I checked you have the correct code. Is there an issue with the grader in that part or something that prevents you from completing the assignment. Thanks
Hello @lloyd.vince,
Oh there is a bug here, hope it helps:
You used double \\ in your code
reviews_product_metadata_df[column] = reviews_product_metadata_df[column].str.strip().str.replace('\\s+', ' ', regex=True) <--Use single \
Correct:
reviews_product_metadata_df[column] = reviews_product_metadata_df[column].str.strip().str.replace('\s+', ' ', regex=True)`
Thanks Georgio, All good now