Hello Schorlars! Kindly help me out on this. I want to add emi to the data but I got errors. Have tried the following codes:
I am trying to do the exercise in lesson 2 of python os and filesystem.
Thanks in anticipation. I have been able to create function and get a columnar dictionary below:
Use print statements in the for loop to debug your code, print "loan" and see what value it has. Variable loan is just a string representing a key of the loans dictionary.
Yes, but I’m not satisfied with the way I did it. I would appreciate if I can get a better way to solve it, if possible.
I created another csv function which read the data in dict format of like the example. Something like this: {[a:1,b:2],[a:3,b:4]} and not in columnar format, then I apply the function of emis to the new function, and append only the emis column to the columnar dict.
I believe this is not professional, though, I was able to arrive at the solution.
In case you want to to store data in columnar dictionary like above “loans_1”. Just remove for loop, this mean that you need to modify “loan_emi” function to take array as parameter. Another the way to solve is modify for loop to “for index in len(loans[‘amount’])” and use loans[‘amount’][index], loans[‘duration’][index],…
Have tried this but I still got an error message for the for loop. for index in len(loan[‘amount’]) returns an error message. And I don’t really understand how to make the emi function parameter array.
I mean “for index in len(loans[‘amount’])” not “loan”. Because parameter “loans” you passing in function “compute_emi” is a dictionary, therefore len(loans[‘amount’]) you you length of array [100000, 200000, 628400,…] which is 9. Basically, in for loop, you go through: loans[‘amount’][0]=100000, loans[‘duration’][0]=36, loans[‘rate’][0]=0.08, loans[‘down_payment’][0]=20000,… to loans[‘amount’][8]=423000,…
Please I’m stuck somewhere else too. I want to add a column to a data frame using a categorical variable. How can I do this?
One of the exercise in the last lesson whereby we were asked to add a col of age group. I tried doing this but the process is too long. I would appreciate if I can get a more professional way.
What I did was:
I sorted the dataset by Age col and used a new index, then created a new col with none value, then, I started changing the value using .loc of the index range. This is a long process cus I have to check the index range of each age category before imputing the value to the new col.
I not take part in this course, so I not quite understand about exercise. In case you want to change numerical column to categorical, you can use pandas.cut
Okay, thank you very much for your help through the course. Please kindly go through my project. I would appreciate your comments. This is the link to the project fasasiganiyat95/customer-personality-analysis - Jovian. I did analysis on customer personality.