Assignment 3 - Pandas Practice

Assignment Details:

Use this thread for asking questions. You can get help with errors or ask for hints, describe your approach in simple words, link to documentation, but please don’t ask for or share the full working answer code on the forum.

5 Likes

Hi,
I am facing the issue While I am trying to print the “countries_df.head()” on colab.
ERROR: AttributeError: ‘NoneType’ object has no attribute ‘items’.
I ran the same code on binder and it was working fine. I failed to figure out the reason for the error.
Does anyone else face the same problem?

3 Likes

Hi rsohlot,

I ran the notebook locally but I tried to open the notebook on Colab, everything works fine on my end. so if you can give some more context on your problem that would be great!

2 Likes

may be you should stay on binder. :slight_smile:

Hi @mrvinegar,
I ran the notebook from the start, faced the problem at the following cell:

when trying to print (Out[8]:):

countries_df.head()

I have read the csv from url.

Maybe try to just read the cvs file with pd.read_csv(‘countries.csv’) instead of the link? see if that would solve the problem.

I have tried both ways.
with countries.csv:


with url:

If I ran the same code on binder, it worked.
It is not stopping me anywhere, but I was just curious to know the reason.

1 Like

I think it might because of the current panda version, I remember that I ran into the problem when I had 1.0.5, you should be able to fix the problem if you use pandas 1.0.3

In optional questions, the binder is showing some warning regarding reindexing…

This is the code I am running although it is showing results but warning pops up!

countries_df.sort_values(‘gdp_per_capita’, ascending = True)[countries_df.population > 100000000].head(10)

/srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
“”"Entry point for launching an IPython kernel.

I first filtered the data to the requested population level on a separate line and then sorted and everything else on a separate line. That worked for me.

4 Likes

Are we expected to clean the data before we provide answers to the assignments? For example, if there is missing data?

Hey, what are the possible grades that we can get in an assignment?

My completed assignment.
Do have a look.

7 Likes

It’s working fine for me on kaggle

Pass or fail just these two.

No we only have to do eda

1 Like

I extracted / separated data for India out of the worldwide data file and now I can’t add a column to this df

Finished the Assignment 3 :smile:

6 Likes

Can someone send me the link on where to find data for India they way Akash did for Italy. I went to world in data, but I was not able to find for India, Kindly send me the link for India, it would be of a great help to me.