Problem with "del" not deleting the row in Introduction to Python, Guided Project: Profitable App Profiles for the App Store and Google Play Markets - Step 3/14

In this step, we are supposed to delete row 10473 which worked the first time I ran the code. Afterward, I commented out the “del” statement out because it says not to use “del” again and printed the line again to make sure it was deleted, however, line 10473 is still there and has the same values. Running the “del” statement does not work anymore. Why is this happening and is there a workaround?

All of the code is on the Jupyter platform
Here is the code showing the row still being there:

print(g_apps_data[10473])
print(len(g_apps_data))

OUTPUT:
[‘Life Made WI-Fi Touchscreen Photo Frame’, ‘1.9’, ‘19’, ‘3.0M’, ‘1,000+’, ‘Free’, ‘0’, ‘Everyone’, ‘’, ‘February 11, 2018’, ‘1.0.19’, ‘4.0 and up’]
10842

Here is the code showing the “del” statement not working:

print(g_apps_data[10473])
print(len(g_apps_data))
del g_apps_data[10473] This has already been ran, do not run again
print(g_apps_data[10473])
print(len(g_apps_data))

OUTPUT:
File “”, line 3
del g_apps_data[10473] This has already been ran, do not run again
^
SyntaxError: invalid syntax

hey @donniegoode

the del statement works for me. Please share your notebook, let’s probe what’s different.

This is how I have done it in my notebook.

Sounds good @Rucha, how should I share the notebook with you? I can send it as a ipynb file if you want to do that.

hey @donniegoode

try this:

Share your project

1 Like

Hey @Rucha, somehow I fixed the issue and am unable to replicate the issue again for us to further diagnose. The only issue now is my folly of not commenting out “This has already been ran, do not run again” :rofl: ! That may have been the issue to begin with but not 100% certain.

Thank you for sharing the link Sharing Your Guided Project in the Community, it will come in handy later down the road!