Shifting Values in Row

Screen Link:

https://app.dataquest.io/m/467/communicating-results/2/the-scenario
My Code:

import pandas as pd

playstore = pd.read_csv("googleplaystore.csv")
print(playstore.shape)

answer = "no"
app_info = (["Life Made WI-Fi Touchscreen Photo Frame", "LIFESTYLE", 1.9, 19, 3.0M, "1,000+", "Free", 0, "Everyone", NaN, "February 11, 2018", "1.0.19", "4.0 and up"])
playstore.loc[10472] = app_info
playstore.drop(labels=10472, inplace=True)

What I expected to happen:
Index label 10472 to be replaced with values above.

What actually happened:

SyntaxError: invalid syntax

If the answer were yes, how could I replace the values in label 10472 using the values above? Also, is there an easier way to do so by shifting the row values?

2 Likes

Hey @vroomvroom,

You didn’t wrap NaN and your alpha-numeric values in quotes in this line. That’s where the problem is. And no need to use brackets and parenthesis at the same time, using only one of them would work.

It should be like this:

app_info = ["Life Made WI-Fi Touchscreen Photo Frame", "LIFESTYLE", 1.9, 19, "3.0M", "1,000+", "Free", 0, "Everyone", "NaN", "February 11, 2018", "1.0.19", "4.0 and up"]
playstore.loc[10472] = app_info
print(playstore.loc[10472])

3 Likes