Difficulties on exercise "Processing CSV files using a dictionary of lists"

Hi, I am having some serious difficulties on this exercise. I think I got it ok for the 1st part, but I am stuck on the 2nd part. Open the file and differentiate headers from values with def_parse functions was ok, but then I am completely lost. I tried different things to create a list with the values from the file’s columns, but all brought me to errors that I was not able to solve (I’m a python beginner). I don’t know how to approach the problem anymore, can someone guide me on this please ?

I have to correct this post because today I’m starting with https://jovian.ai/learn/data-analysis-with-python-zero-to-pandas/lesson/lesson-3-numerical-computing-with-numpy, maybe you should try to check this lesson before trying the exercise, i think the numpy library will provide you a better way to solve the exercise than the code above, anyway i’m leaving it, it may help you to understand the logic to create the dictionary.

1 Like

Hi Miguel, thank you for your responses, indeed I am doing the exercise with close attention to the lesson 3. However I still can’t figure out how, and I m not sure I understand all the steps of your code. I am experiencing two struggles here, the first one with the logic, the second one with the right syntax.
The way I see it is first to define what a header is and what a value is, so far ok. Then, I would like to define 4 lists which would represent the 4 different columns (without the headers), and then include them into a dictionary, with the headers being the 4 different keys, and the 4 columns being the values of the dictionary. Please let me know if the logic makes sense, if it’s possible to do it this way, if it’s a good way to do it, and if so, how can I do it. Thank you very much for your help !

Hello again Quentin,

I,m posting here a notebook with the new code I wrote for the exercise, the previous code was confusing and impractical. This one includes the Numpy library to solve the problem. I have not finish the last step of the exercise and there are no explanations of the code for the moment. Anyway for each step there is a printed output in order to understand them better.

1 Like

Hi Miguel, thank you again for your response. I’ve been through the file and it indeed helped me a lot to understand and solve part 2 and 3. I’ve also included some intermediate functions. Now doing part 4 but already having some obstacles… Anyway, if you want to have a look, here below is my code so far:

1 Like

Hi Quentin,

Awesome!!! I’m really glad it helped. The exercise it’s kind of tricky but it’s worthy to put some effort on it, i’ve learn a lot by doing it, i’m sure you too. Make sure you post it here when you finish i would like to see it :+1:

Good luck on your learning journey!!!

1 Like