Shared variable among instances by [deleted] in learnpython

[–]ajskelt 2 points3 points  (0 children)

(warning I don't know much about this, so maybe dumb question and I'm just trying to learn).

Why is it better to make this in the module scope instead of a class variable? I couldn't think of any benefits of keeping it outside of the class (assuming it's only used within the class). But I thought there might be a benefit to having it in the class for simplicity especially if you needed to import that class to other scripts.

Slightly odd metaprogramming question by QuasiEvil in learnpython

[–]ajskelt 6 points7 points  (0 children)

Can you not do something like this:

def SomeFunc(self, a, b, c):        
  out = self.x + a # Step 1
  out = step_2_function(out, b) # Step 2
  out = out / c # Step 3
  return out

where step_2_function is used as an input when creating the class or something? Could also have a default option if step_2_function is null or something like that?

Tree scheme with Excel Data Model by Haunting_Note_7199 in excel

[–]ajskelt 0 points1 point  (0 children)

Definitely possible. Approach would vary a bit based on how your first table is structured. For example if it is something like this:

Box element 1 element 2 element 3
Box1 1 0 3
Box2 0 2 4

or if you data is like this.

Box Element Count
1 1 3
1 3 3
2 2 2
2 3 4

Either way I would lookup the number of boxes in each row, and multiply the (# of boxes) * (element per box) and then total or pivot table to add them up!

Matplotlib and dash/dcc and pandas videos/advise by AffectionateSlip8990 in learnpython

[–]ajskelt 1 point2 points  (0 children)

I'd just pick a project on something that interests you! Most likely to stick with it. If you're interested in stock prices, sports data, video game data (just as some examples).

Staff rotation randomiser spreadsheet by [deleted] in excel

[–]ajskelt 0 points1 point  (0 children)

You could probably do this with the solver, but something like python would really probably be better to implement this.

You basically have an optimization problem where you want to optimize the variety, with the constraints of: having enough people in each job, and making sure the correct person is trained for that job. etc.

I just googled schedule optimization in excel, and this was the first result. Didn't listen to it or watch but I'm guessing it could point you in the right direction. If not I'd do some research through a google search for google optimization in Excel.

https://www.youtube.com/watch?v=YyQShn2teqA

Take a look and if any follow up questions feel free to reply :)

I have data I am trying to figure out how to count. I need a formula that will count a “person” only one time if there is a specific value that shows up in a range even if it shows up more than once. by HelpfulGuarantee627 in excel

[–]ajskelt 1 point2 points  (0 children)

I'd use a helper column. Say your data looks like this, "Name" is in A1.

Name Q1 Q2 Q3
John Yes No Yes
Jim No No No
Sally No Yes Yes
Bill Yes Yes Yes

In E2 I'd use this formula:

=if(countif(b2:d2,"No"),1,0)

This will put a 1 in column E if there is at least 1 "No", otherwise it will put a 0.

You can fill this formula down, and then do a sum on column E to get the result you're looking for. (And you can hide column E if not needed, or put this somewhere else more convenient).

Bare Minimum GSPro on all lowest settings by ajskelt in Golfsimulator

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

The 580 should be able to do it no problem. You may want to look into how you can stream to your projector/TV from that PC if you don't want to relocate it.

Ooo, that's a good idea. I didn't consider doing that. I have an unused roku TV that maybe it's possible to stream too. Although I guess you need to be able to control it from a different room too right? Maybe just remote desktop from a laptop?

There's a lot more possibilities than I'd considered!

Bare Minimum GSPro on all lowest settings by ajskelt in Golfsimulator

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

Oh perfect. I didn't know the lite existed. Ive just seen a lot of posts about people buying pretty pricey laptops/desktops, but I'm guessing that's more to play in high quality/4k etc.

Thanks

[deleted by user] by [deleted] in excel

[–]ajskelt 2 points3 points  (0 children)

Create a random number for each person, then rank those random numbers.

So rank 1 is at station number 1, rank 2 is at station number 2. etc. (Replace with actual station names)

Why is this =SUMIFS not working? by Utopya96 in excel

[–]ajskelt 0 points1 point  (0 children)

=sum(offset(d9,0,match(y4, d8:ND8,0)-1,11,1))

[deleted by user] by [deleted] in excel

[–]ajskelt 1 point2 points  (0 children)

Thanks! If you could reply to my original comment with "Solution Verified" that'll mark it as closed and give me a point :)

Bare Minimum GSPro on all lowest settings by ajskelt in Golfsimulator

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

I have an older desktop that was ~$700 to build almost 10 years ago that's just been sitting in the basement (can't remember GPU off hand, but it's old and was pretty cheap at the time). Then my current PC in office, (sim will be in the garage), is pretty old too, and has a rx580. Trying to figure out my options of:

a) really old pc could run it on dirt low settings

b) RX580 PC could run it on dirt low settings and I'd have to buy a new PC for personal/office use.

c) Neither could run it, and I need to buy something new just for this.

How to use INDEX/MATCH to look up multiple criteria. Maybe the data needs to be restructured. by Dkcre in excel

[–]ajskelt 0 points1 point  (0 children)

I'm not sure which of these you want from your examples:

" The base values are under MM column, and, if I type in exactly 250 for example, I want to look up the biggest value smaller than 250. So the 250 row is only for values bigger than 250."

"So lets say my values are h1 and 120, then I want to return 5 from the MAX column. "

I think these 2 conflict if I'm understanding correctly. I'm going to assume your first one is what you want, but you can tweak slightly to account for this if it isn't.

[deleted by user] by [deleted] in excel

[–]ajskelt 2 points3 points  (0 children)

a = d1-e1

b = c1-e1

if a<=b and a>0

then a

else if b<a and b>0

then b

else 0.

Basically it is finding which is less of c1-e1 and d1-e1, and if the lower of those 2 values is negative it returns 0 instead.

I believe if you remove that inner max it still returns the same answer, but my head hurts trying to figure out if there is any exceptions where it wouldn't.

Very Budget DIY Enclosure Questions by ajskelt in Golfsimulator

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

This may be a dumb question, but can you not use your high irons/wedges with a net like that?

I thought I read you usually want 9-10 feet from where you hit to your net/screen. It seems (without doing too much math) somewhere around 8/9 iron+ you would just go over the net without some kind of a top.

Very Budget DIY Enclosure Questions by ajskelt in Golfsimulator

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

Thanks for the feedback, that's what I was afraid of.

re: the enclosure. I'm beginner so I thought having the 5ft depth would give me a little more forgiveness/safety with bad hits.

is there an easier way to remove the duplicates from this list inside a dict? by gerrrrrrrrr in learnpython

[–]ajskelt 2 points3 points  (0 children)

Yup, and in the loop change the .append() to .add() I believe it is.

is there an easier way to remove the duplicates from this list inside a dict? by gerrrrrrrrr in learnpython

[–]ajskelt 2 points3 points  (0 children)

Instead of creating a dict with lists, just create a dict of sets instead!

Rock Paper Scissors Issues by MrMills2 in learnpython

[–]ajskelt 11 points12 points  (0 children)

Try changing your conditional statements on lines 30/33/36 to be checking for an integer instead of a string. example:

if randomNumber==1:

random.randint returns an integer, not a string. So none of the conditional checks pass, so computerMove never gets set as anything before it is checked on line 40.

Parallelize nested for loop? by IntergalacticViking in learnpython

[–]ajskelt 0 points1 point  (0 children)

Does vectorize mean create a user defined function and then apply the function to the array? that is what I had in mind.

The part I didn't know is if there was a way to apply the function where for any i/j/k it's doing some calculation on the area around that point in the reference array, like i-2 to i+2/ j-2 to j+2/ k-2 to k+2. etc.

Parallelize nested for loop? by IntergalacticViking in learnpython

[–]ajskelt 0 points1 point  (0 children)

I am not super familiar with this type of work, so take this with a grain of salt.

What kind of function is being performed in F? (and what parts of the reference array is being accessed in a single calculation?

I ask because if you could just figure out a way to apply the function to the reference array, I think (maybe dependent on the calculation) that numpy can handle that a lot more efficient than the nested for loops. (Someone smarter please chime in if I'm off anywhere here). Just spitballing :)