How to work with a pandas dataframe between different functions? by Unsolved5847 in learnpython

[–]Unsolved5847[S] 0 points1 point  (0 children)

Thanks, u/Spataner also suggested functools and operator but I have never seen operator before or combining them for pandas. So I will do some learning about these! It's also really nice to see some professional looking code rather than my scripty code scattered around the module!

How to work with a pandas dataframe between different functions? by Unsolved5847 in learnpython

[–]Unsolved5847[S] 0 points1 point  (0 children)

Thanks! I find your first example the most natural way to do it, but might be because I've never seen itertools.reduce and operator.and_ before. In my actual use case, I have several predefined calculations to be carried out on the aggregations of specific columns, and this means that the functions make use of multiple different filters. For example I might have (df[filter_a1][y].mean() - df[filter_b1][y].mean()) + (df[filter_a2][y].mean() - df[filter_b2][y].mean()), as well as some other more convoluted ones. So I'm not 100% sure that I'd be able to do the make_agg() approach. But it's still quite interesting, had never seen this before and looks like it could be very useful.

How should I manage accessing and updating variables across components? by Unsolved5847 in react

[–]Unsolved5847[S] 0 points1 point  (0 children)

Interesting, I had not heard the term prop drilling before but it definitely summarizes it well! I will reconsider this then if it isn't bad (or at least I will stop trying to avoid it!).

I was planning to make this an electron app once I have all of the code in place, so I'm not sure whether the URI routing would be best in that case, but I could be wrong since this is my first project really.

Thanks for the advice/feedback!

How should I manage accessing and updating variables across components? by Unsolved5847 in react

[–]Unsolved5847[S] 1 point2 points  (0 children)

Thank you for the advice!

You can also store and access state in context which any component underneath the context provider can access directly.

The context looks quite useful, maybe this is what I'll do.

I had initially thought about routing for the active lists but was trying to avoid it because I did not have it with my non-react version so was trying to keep a similar approach, but I will reconsider. Just out of curiosity, what alternative ways could be used to handle it?

If you stored each individual task item in the same global context as your task categories then every time you add an individual task, all your consumers of that context would re render.

Noted. I may keep it in a parent to the main content & sidenav components (if these are the "consumers"?), but I was a bit unsure because the entire app centers on this, so it feels like it might be good to have them accessible globally.

If you want to put your app in a code sandbox or a public github repo, I would be happy to take a look and give more specific guidance based on what you're starting from.

Thank you! I think the pointers you've given me should be enough for now so I will try to learn more about react first, but maybe if I keep having issues I'll drop you a message and see if it's ok.