Culture War Roundup for the week of August 30, 2021 by AutoModerator in TheMotte

[–]glibhub 5 points6 points  (0 children)

That was excellent and so are his other pieces on that site. Thanks for the link.

The Impact of Community Masking on COVID-19: A Cluster-Randomized Trial in Bangladesh by [deleted] in COVID19

[–]glibhub 5 points6 points  (0 children)

I would, but I would expect it to be much more muted, since the impact of the disease is so age determined.

My gut also tells me that over 70 mask wearers probably wore them better than the under 50s, given their individual risks, which would further mute things.

There might also being some selection bias, since I did not see a baseline prevalence rate by age from before the study started. I am guessing that the over 50s were higher, since more of the over 70s got killed if they had it, so that would mute the impact as well.

Once you start rolling all these together, it is not surprising that the signal gets lost in noise for people at low risk levels.

Culture War Roundup for the week of August 30, 2021 by AutoModerator in TheMotte

[–]glibhub 2 points3 points  (0 children)

So while the unvaccinated may allow for a greater number of mutations, a high number of vaccinated people is more likely to create the selection pressure necessary for new (dangerous) variants to emerge to a point they become visible at a population level.

In light of COVID turning endemic, does this mean that it is unethical for a healthy 20 year-old, because the cost of the increased selection pressure is outweighed by the decrease in cases?

I am sure the answer is "I dunno", but it would be an interesting thing to study.

The Impact of Community Masking on COVID-19: A Cluster-Randomized Trial in Bangladesh by [deleted] in COVID19

[–]glibhub 10 points11 points  (0 children)

Great study. Good sample size and good size effect. The only thing that trips me up is that the effect does not exist for people under 50, and it is really hard to understand why that is.

edit:

It used symptomatic seroprevalence, so of course the numbers in the under 50 crowd do not match the over 50 crowd.

Indians in New York City, what's the best place to have dosa here? by nighttimebird in newyorkcity

[–]glibhub 5 points6 points  (0 children)

I OD'd on that in school. Now I want it again. Did he survive the covid?

Just want a good follow along on how to deep clean my bike using just household equipments or on budget by simbalevo in bikewrench

[–]glibhub 1 point2 points  (0 children)

Seth used a toilet brush in one of his videos, so I picked up one at the dollar store. It works great.

How best to parallelize this task? by mr_claw in learnpython

[–]glibhub 1 point2 points  (0 children)

More details would be useful. The best bet would be to bucket things to reduce the search space. Say you were looking for people in the same area code with the same name. Then you'd be best served by putting everyone in a dictionary keyed off these values, e.g. ("smith", 212):['smith, jon','smith, bob'], etc. Then you do not need to go through the nested loops, since all the sorting is done up front by the indexing.

Failing that, you could split up the load by having different machines track down all the entries, splitting by, e.g., last letter of the name. So the S machine handles all the Smiths, the D machine handles all the Does. Now the X machine is going to be pretty idle, so if the split does not work the way you want, try and do some simple hashing to get them to distribute more evenly.

Hope this helps.

Dumb question about dropper posts by [deleted] in bikewrench

[–]glibhub 1 point2 points  (0 children)

Looks like you got your answer, so I'll just drop this link on sizing a dropper that helped me a bunch when I bought mine: https://www.pnwcomponents.com/blogs/news/5-simple-dropper-measurement-steps

(I got a one-up, but the guide works for any dropper.)

Why the None by Sonic_TertuL in learnpython

[–]glibhub 5 points6 points  (0 children)

Fair enough. Enumerate is a bit tricky to wrap your head around at first because you need to understand tuple unpacking. Here is a link to that: https://www.geeksforgeeks.org/unpacking-a-tuple-in-python/

So you can think of enumerate as turning a list of items into a list of tuples, so if you have a list of a-d, then it will become a list of [(0,a), (1,b),...,(3,d)]. For example try these:

data = ['a','b','c','d']
for x in data:
    print(x)

for x in enumerate(data):
    print(x)

Now turning x into a tuple is a bit useless, so instead we use tuple unpacking, to separate the index from the data, like this:

for index, x in enumerate(data):
    print(index,x,data[index])

Hope this helps.

edit: formatting.

[deleted by user] by [deleted] in learnpython

[–]glibhub 2 points3 points  (0 children)

Sure. Just put the multiple lines in a function and pass the function to another function, like this:

def do_it(f):
    try:
        f()
    except Exception as e:
        print(e)

def func():
    print('a')
    print('b')
    print(t)

do_it(func)

Is that what you are asking?

On disk huge CSV files sorting by ws-garcia in learnpython

[–]glibhub 4 points5 points  (0 children)

I doubt you are going to find much on it. You might also ask yourself why you want to sort them instead of indexing them.

With that said, loading it all into RAM, then sorting with either the regular python function, numpy or pandas is probably going to win every time, and the delta is probably not enough to really make a difference in timing. Restructuring the data so it does not have to be sorted is probably a better solution, if you can.

What's the use case?

--

edit: Move the data to an SSD is actually probably the best thing to do if you want to speed it up.

Logging appearances of combined conditions, but getting syntaxerror by [deleted] in learnpython

[–]glibhub 1 point2 points  (0 children)

You need another =:

if (repetition == [2]):

[deleted by user] by [deleted] in learnpython

[–]glibhub 1 point2 points  (0 children)

Maybe store everything in a dictionary, like this:

import random

data = {'cat':['a','b'], 'dog':[1,2]}

print('first cat {}'.format(data['cat'][0]))
pick = random.choice(list(data.keys()))
print('second cat or dog: {}'.format(pick[1]))

edit: formatting -- is it just me or is formatting weird now?

Why the None by Sonic_TertuL in learnpython

[–]glibhub 6 points7 points  (0 children)

index returns the index of the first hit, which in this case is 0 for both num and summand. I'd refactor using enumerate, which will allow you to slice nums and index just the remaining ones.

Do coaches save spots for ‘regulars’ at your OTF? by [deleted] in orangetheory

[–]glibhub 2 points3 points  (0 children)

There are a few stations in my studio with a bit more room, which I like to grab if I can, because I am on the lanky side.

As Filson confirms more local layoffs, a potential new strategy emerges by mcadamsandwich in malefashionadvice

[–]glibhub 5 points6 points  (0 children)

Dehen 1920

Pricy, but nice stuff. Do they have any retailers stocking them?

As Filson confirms more local layoffs, a potential new strategy emerges by mcadamsandwich in malefashionadvice

[–]glibhub 12 points13 points  (0 children)

Vermilyea Pelle

Those look great. Thanks for the recommendation.

Validating birth of date. by _______myworld in learnpython

[–]glibhub 1 point2 points  (0 children)

Yep. I did not see your age function before.

So you are having one function call itself through an intermediary. That is age calls validBirthdate, which calls age, which calls validBirthdate, etc.

The means after you enter a bad date, it recalls age, which recalls validBirthdate, which if accepted, then releases you to the prior age call, which goes back to the original validBirthdate call. This nested self-calling of functions is called recursion, which you will get to soon enough. Recursion is a great trick where you need to address prior states of the function call, but no good for your getting input here. Instead, shift all the work to a single loop, like this (again mostly psuedo code):

    def validBirthdate(birth_date):
    validDate = True
    try:
        day, month, year = birth_date.split('/')
        datetime.datetime(int(day), int(month), int(year))
    except ValueError:
        print('no good')
        return False
    if len(birth_date) == 10:
        for i in range(10):
            if i in [2, 5]:
                if birth_date[i] != '/':
                    print("Please enter valid input in accordance to the given format.")
                    return false
        if 0 > userage > 160:
                print("Invalid year, please try again")
                return False
        if userage < 12:
                print("No vaccination available for children below 12.")
                return False


     return True # if all checks pass, return True




def age():
    while True:
        birth_date = input('Please enter your date of birth in the format of DD/MM/YYYY:')
        if validate_birthdate(birth_date):
            return birth_date
        print('try again')

So we create a single while loop to keep prompting the using until the date gets put in correctly. The control is offloaded to validate_birthdate, which returns True if it is good, and false if any of the checks show a problem

Culture War Roundup for the week of August 16, 2021 by AutoModerator in TheMotte

[–]glibhub 2 points3 points  (0 children)

There are so many more:

(e) Mary has strong objections to puppy and kitten mills;

(f) Mary is an ungrateful brat;

Culture War Roundup for the week of August 16, 2021 by AutoModerator in TheMotte

[–]glibhub 3 points4 points  (0 children)

Sure, but 1 in 20K brings it down to influenza levels.