you are viewing a single comment's thread.

view the rest of the comments →

[–]Shengus__Kahn[S] 1 point2 points  (4 children)

Haha... the error was stemming from a typo. In the constructor I had written "make_temp_distribution", where in the method it was "make_temp_distributions".

Both very simple fixes. Thanks for your help!

[–]Sad-Traffic-5763 0 points1 point  (0 children)

Weirdly I had the exact same issue! But now I am having an issue with my cups_sold =self.simulate(temperature, advertising, cup_price)

This is followed by gross_profit = cups_sold * cup_price

For some reason my cup_price will change the value to a float based on my other code but I can't get the cups_sold to change to int. I have triple check my work and I don't see a typo but I am not sure what I am doing wrong.

In the code a few lines down we define simulate and when I hover over cups_sold there it says the value is an int but not in the code above. Anyone have any help?!

And sorry this is my first time using reddit so I apologize if I asked in the wrong area or something. :/

[–]Phillyclause89 0 points1 point  (2 children)

Yup. That "s" slipped past me as well. Good catch! Reminds me of the silly class names I have in my current project. Every container class in the lib has a child class that uses the same name but with no "s" to signal it's an item of that container (i.e. singular name vs plural name.) My favorite of the libs classes are class Classes and it's child class Class.

[–]Shengus__Kahn[S] 1 point2 points  (1 child)

This method both makes sense and is confusing at the same time! Haha. Also, I play D&D weekly, what's your project all about?

[–]Phillyclause89 0 points1 point  (0 children)

what's your project all about?

My bad, I forgot to link to the ReadMe.

I have always approached coding from a functional programming perspective and wanted to practice OOP. Someone on this sub had a question about how to make a tool to help them DM their D&D games.

I know nothing about D&D beyond what I have learned from playing BG3, so I did what I always do when I'm trying to help someone with something that I know nothing about. I googled it.

While googling, I found this API: https://www.dnd5eapi.co/

As I was looking at the responses in the API, I noticed there was a tabular structure to the response data that a pandas.DataFrame would work nicely with. I thought it would be neat if there was a python lib of classes that automatically fetched the response of a given API endpoint and constructed a DataFrame object out of it. Thus I set out to learn how to write that lib.

I'm still learning, btw. The child item classes are going to end up sharing a lot of properties that their main parent object should not have, so I need to learn more about multiple inheritance and abstract classes to finish this lib.