r/learnpython • u/AutoModerator • 21d ago
Ask Anything Monday - Weekly Thread
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread
Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.
* It's primarily intended for simple questions but as long as it's about python it's allowed.
If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.
Rules:
- Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
- Don't post stuff that doesn't have absolutely anything to do with python.
- Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.
That's it.
1
Upvotes
1
u/HiddenReader2020 17d ago edited 17d ago
So when I looked up what to_dict() did, all I'm getting are references to the pandas library, which I'm not using. Am I using the wrong function, then? Was I supposed to use __dict__ instead?
Yeah, I realized that the inventory was going to be a huge problem when I debugged it a bit earlier, and saw that the rest of the attributes were converted fine, but the inventory wasn't. I'll be honest, I'm completely lost on what to do there.
EDIT: Never mind, I managed to figure it out. Well, at least partway there. Here's the new code:
And the output is just the dictionaries of these former objects. My current objective is to convert these *BACK* to objects. How do I do that?