« first day (3257 days earlier)      last day (1682 days later) » 
00:00 - 15:0015:00 - 00:00

12:43 AM
cbg
 
1:16 AM
cbg
something confuzzles me, what am i doing wrong here (im generating some simple aggregate of a biased coin flip in this example so I can plot the Gaussian distribution it creates) np.random.choice([0,1],1000,p=[1-p,p]).sum(),(1000,1)). I thought I basically could tell it to use my aggregate as the function (or make a lambda) but no cigar
I can do it with list comprehension like this: test=[np.random.choice([0,1],1000,p=[1-p,p]).sum() for i in range(0,1000)] but that kinda ignores the strength of numpy and how it should be able to do things like this very fast and vectorized (list comprehension already starts to show slowdowns at around 10000 for example)
 
 
3 hours later…
4:13 AM
This question Pandas: convert datetime timestamp to whether it's day or night? should be left open I suppose, but it's unanswerable unless we know the latitude (especially) and longitude. Unless the OP wants a very crude approximation "before 7am = night", "after 6pm = night".
 
 
1 hour later…
5:39 AM
Apparently even comments that answer the question are subject to deletion nowadays? This site is getting crazier by the week
 
cbg
@Aran-Fey your comments are getting deleted?
 
5:58 AM
just one
 
thats fun
 
 
1 hour later…
7:16 AM
I suppose the official stance on comments is that they shouldn't be answering questions.
But i haven't seen or heard of deletions because of it so far.
 
7:44 AM
@Skyler (np.random.random((nbatch, nsample)) < p).sum(-1)
@Aran-Fey what Paritosh said. Answers in comments have always been soft deprecated, and these days any comment will get deleted if flagged and some specific mods see it first
 
@AndrasDeak is that returning a float btw?
 
@Skyler try and see
in Discussion on question by Madara Uchiha: Should the mod team tighten up moderation on Meta comments?, Aug 3 at 21:01, by Andras Deak
@johnhennig there isn’t really a difference except to say we aren’t as quick on the delete button as we are on main. We will literally delete comments without a thought on main. We at least think about it here, however briefly. — George Stocker ♦ 29 mins ago
 
oh i see, you're generating a T/F array
@AndrasDeak, something weird I saw though, it looks like this method seems to generate less normally distributed values then the list comprehension
with 10000 nsample i wouldnt expect to see that like 2/5 of the times i ran it
 
Hmmmm
That definitely looks bad. I'll check it out later from laptop
What's your p? 0.8 or so?
 
8:01 AM
yea
 
Try np.random.rand in the meantime. There's a new random machinery but it shouldn't be bad at all
 
hmm, i think nbatch may have been too small for that, i wouldve thought 100 batches of aggregates would suppress that though
i think that was nbatch 100 and nsample 10000
 
Ah, I think I see what you're doing. How is that curve of yours generated? Some cdf approximation, right?
 
8:16 AM
kde
i was using the pandas built in density plot
 
Bet that fits the sum of gaussians on your fuzzy data
Never trust black boxes unless you know what they're (you're) doing
100 samples are very much insufficient to fit a smooth density
 
so basically it takes up to n number of gaussians and fits those to the data I provide
 
In any case fitting some smooth density without information about the underlying distribution is sketchy
@Skyler no idea, the docs should say
You can probably choose a distribution class
 
the thing is that even a histogram doesnt look so great
 
But a histogram is truth
If the histogram looks bad use different bin sizes and/or increase sample size
Almost certainly the fitting is based on the histogram, so that's the middle-man you have to look at first
 
8:23 AM
well actually it makes sense, if we take only 100 batches on a histogram isnt enough
 
6 mins ago, by Andras Deak
100 samples are very much insufficient to fit a smooth density
 
very much so
 
user10984358
9:07 AM
Heya guys, if I have a simple find function that works with normal text files and accepts word(word to be searched) and wordMatch ( True or False, it makes word as ‘/b’+word+’/b’ ) as parameters. Question is should I have an if (wordMatch): normal str.find for the one without word match and else: a Regex search for one with word match or just use one regex search with the pattern appropriately defined?
 
user10984358
file is read line by line
 
no idea what you're trying to ask. too many words. can you make an mcve?
 
user10984358
Ok hold on
 
# option 1:
pattern = rf'\b{word}\b' if match_word else word
if re.search(pattern, string): # or whatever arg order
    pass

# option 2:
if match_word:
    pattern = rf'\b{word}\b'
    found = re.search(pattern, string)
else:
    found = word in string
if found:
    pass
that's how I read it ^
 
user10984358
Exactly
 
user10984358
9:15 AM
I am using option 2 rn. I wanted to know if using a regex for just a find without word match would take a toll on performance
 
Which kind of answers your question I think. As much as I prefer atring built-ins to regex the latter one seems way too complicated for the sole purpsoe of maybe being marginally faster
 
user10984358
Also I just learnt that one can use f and r strings together. Didn’t know that.
 
(s/atring/string/ of course)
 
cbg
 
9:35 AM
cbg guys o/
 
cbg
 
Hi Guys,
How to move cell values in excel using pandas?
Ex:
S.No	Name	A	B	C	D	Total
1	Name1	10	20	30	40	80
2	Name2

I have to move 1st row 'B' column to 2nd row 'B' column value.
Please help me.
 
does this mean you have a pandas dataframe created from your excel table?
 
yes @AndrasDeak
 
OK. So I don't know the excel <-> pandas part, hopefully you do. As far as your dataframe is concerned df.loc[2, 'B'] = df.loc[1, 'B'] or something similar should work
 
Okay.. I will try...
Thank you
 
cbg
 
@wim what's up with that comment?
I mean the one on your answer. It's...confusing
 
but 10k views means it's a useful post, even if there is no mcve, no?
 
lol, no
it just means that a lot of people were dragged there for no reason
there's no .time being mentioned anywhere, which is what the error is about
 
9:50 AM
if the problem were properly described through an mcve, it wouldn't exist. coupled with there being a bunch of upvotes on the answer, I'd have thought that the post is moderately useful
 
it could be useful closed
 
if it's a good idea to have it closed, I'll lend a vote. I saw no need since
> Active 8 years ago
I'm probably already spending more thought than it's worth with this discussion =/
 
actually it was active 15 minutes ago when wim deleted his answer after a weird comment on it
 
back to the bad old days with needing 5 cvs
 
wim
yeah I only noticed this old post because of that weird comment
it's useless content to have onsite, so deleted my answer (even though it was at +2/-0) and would like to see the Q deleted too
 
10:15 AM
@wim Closed. But I guess it won't be easy to delete with that upvoted accepted answer.
 
I thought only the question's score mattered
 
Is it okay to close such old questions?
 
yes
 
@wim The commenter didn't explain what "doesn't work" means, but he forgot to subtract the start time from the end time.
 
@TheLittleNaruto Useless ones, anyway. There are a lot of old questions that would be closed as too broad these days and those should stay. But questions that don't really have a useful question shouldn't be kept around.
you have to ask yourself whether someone with the same problem would be able to find that question and reach enlightenment
 
10:18 AM
Yep right
 
@AndrasDeak You could be right, though upvoted &/or accepted answers do block auto-deletion.
 
Auto, of course! A single answer with +1 net vote will block roomba.
 
@PM2Ring ^
 
"won't be easy to delete" just means one or two more delvotes will be needed in 2 days
 
roomba?
 
10:19 AM
 
@TheLittleNaruto Even though it's old, it has a negative effect on the site. It has positive scores & 10k views, so it ranks well in search engines, and therefore pollutes search results.
 
@PM2Ring Well in that case; we are helpless?
 
Why would we be?
you might be; we aren't :P
 
I mean we can't delete those questions since they ahve accepted answers
 
No. Roomba and OP can't delete those questions.
20k+ users can even delete the accepted answers themselves (something that the answerer can't themselves do, hilariously)
 
10:23 AM
:O
 
> It takes 3 votes, minimum, to delete a closed question. However, the number of delete votes required scales to the number of votes on the question and all its answers.
also, @PM was right ^
 
:)
 
Guess I have to work on my rep
Looks like it's lunch time for Aran-Fey
;-)
 
I don't know what we're talking about, but it's actually lunch time now
 
we're talking about your lunch
 
10:31 AM
it'll probably be a more interesting conversation when I actually get around to making it
it'll be pancakes by the way. Yum
 
ooh, could you share some too please? :)
 
no, they're all mine >:I
 
aww, alright. sniffs It's okay.
 
@Aran-Fey mhmm yum
I take it when you say pancakes it's proper crepe and not some other crap thing
 
hm, i had to google crepe. And that does not look like what i imagined when i think pancakes
 
10:35 AM
it's what we call pancakes, and Austro-Hungarian ties are strong ;)
palatschinke ftw
 
do you mean a proper Pfannkuchen or a Berliner one?
 
I'm a culinary n00b, so I have no idea what the difference between a crepe and a pancake is
 
@MisterMiyagi aren't the latter basically doughnuts?
@Aran-Fey if it looks like a crepe then it's a crepe
US pancakes are thick and buttery
 
that feeling of being screwed when python<tab><tab> yields python python2 python2.7... D:
 
to be fair I've never had American-style pancakes but they don't sound like my cuppa tea
 
10:37 AM
@AndrasDeak they contain at least 20% more fat, jam and awesome
 
@AndrasDeak ah, right. No, not the US kind.
 
Is this a pancake for you Andras?
(And is that considered US kind?)
 
only because "pancake" is a loaded torm
and that looks like US style at least as far as categories are concerned, yes
@MisterMiyagi sounds good
 
Aha okay. In that case, i dont think i've ever had crepe
 
Banana and nutella crepes are the best thing.
if you ever go to France or the Austro-Hungarian empire make sure to try some
 
10:39 AM
I will put that on the list!
 
a proper crepe is very thin, only a few millimeters
 
not like the US style
 
^^ what I'm making
 
@Aran-Fey want
 
10:39 AM
@Aran-Fey good on you!
 
Now you're just teasing us :P
 
that's proper palacsinta
 
@ParitoshSingh sorry, blame Andras for starting the discussion :P
 
@ParitoshSingh Almost. I'd call that a pikelet. A US style pancake is about that thick, but with a larger diameter, substantially filling a dinner plate.
A crepe is rollable, a US pancake is definitely not rollable.
 
Yeah no, at this point of time, i can have a pancake, a pikelet, and a crepe all at once. Give me some honey to go with it, and im set.
 
10:42 AM
no, no, no honey
 
but but but, it's nice!
 
Or in Canada, maple syrup.
 
chocolate sauce or jam or bananas, whipped cream, things like that
 
i can go with chocolate sauce/nutella too! jam, i probably won't. whipped cream sure why not! bananas though...i'll have to try that sometime
 
On crepes: lemon juice & brown sugar.
 
10:43 AM
Oh, i have a hard time imagining how that would taste.
 
@ParitoshSingh bananas and nutella. At the same time. Trust me ;)
 
A British pancake is essentially a thick crepe. They can be rolled, and are filled with almost anything - lemon juice and sugar is one popular choice, others like jam, but there are no discernible rules.
American pancakes are think and non-foldable, and frequently eaten in threes (a "stack")
 
Another topping I like on pancakes or crepes is to cook up some apple & mango juice with a little brown sugar. The sugar gives it a more caramelly taste, and the pectin in the apple acts as a thickener.
 
Quite often with eggs, bacon and maple syrup.
@PM2Ring Sounds wonderful.
 
There is something really wholesome about this conversation. I'm just noticing a kind of silly smile on my face.
 
10:47 AM
Of course, in Australia it's not unknown to put butter & Vegemite on pancakes. :)
Oops. Looks like I killed that conversation...
 
Haha no, you're fine. Just too busy dreaming of pancakes right now
 
Hi there !
I flask app I get "Process finished with exit code 250"
What could this mean?
 
11:04 AM
what is this flask app? Did you make it? what does it do?
 
@Aran-Fey That looks like Dosa
 
@PM2Ring no. Vegemite did! ;D
@TheLittleNaruto I bet that's savoury. A crepe is almost always sweet (we have exceptions though, ew)
 
ohhh, a pancake discussion
 
yeah, crepe/pancakes are nothing like dosa in terms of flavour and texture
 
11:07 AM
Sorry can not tell much
 
@БеляковаАнастасия then probably we can't either
(especially me, but that's not your fault ;)
 
well, the most simple explanation is that you made a mistake somewhere. are you using sys.exit calls in code?
Usually, exit codes are something you should never have to deal with. But if you do encounter them, convention is 0 is "everything is fine, closing program" and everything else is not. However, usually it's the person writing the code to declare what they mean if they use a non zero exit code.
Which, in this case is you, so oops? Some error codes are documented on a "conventional" case, but i think that's os dependent.
 
I always make crepes myself, except when it's blueberry time. Then they get upped to ~1cm thickness and get fried with fresh blueberries in them, and sprinkled with cinnamon sugar. that to me is a feast fit for a god.
 
No there are no such calls.
 
If you're not able to share more details, the best i can say is, start chopping away at your code till the error disappears. See if you can figure out where it's happening. Go from there.
 
11:18 AM
This is from my job I can not show details
 
@Arne do you make them in the same pan? Or something deeper? Does it bake through nicely?
Or do you use a different batter?
 
Looks like the problem was with my environment - I created other and all looks fine
 
@AndrasDeak I never had savoury :(
 
@AndrasDeak different batter, thick pancake gets more flour and egg
 
@Arne OK, that makes more sense
@TheLittleNaruto Hmm? If you mean Dosa I was only guessing. I don't think I've ever had any Indian food.
 
11:29 AM
@TheLittleNaruto Did you have dosa?
 
@Arne pancake can be veg as well right? I had one in our last month team lunch.
@ParitoshSingh Yes I can cook that as well. On Sundays I prepare.
 
Pancake is a forgiving kind of food.
 
forgiving kind? @@
 
So, you wouldn't call dosa sweet right? English doesn't really have a great word for how it tastes, so usually you can consider "savoury" a dump of non-sweet salty-ish type of taste
 
Oh TIL: Savoury
Arigatou Thank you @Paritosh .
 
11:31 AM
^^
 
@TheLittleNaruto yeah, I had ones with milk -> almond milk and egg -> banana once. It was ok, I will stay omnivorous.
 
Good for you; I am a vegetarian. So...
 
@AndrasDeak By the way, you are definitely missing out. ;)
 
12:09 PM
@inspectorG4dget ping: stenotype repo is set up. Only scaffolds up to now, literally 0 lines of code that actually do something. Feel free to hack away, or ask anything, a gitter is linked in the readme.
 
What does it do again?
 
Judging by github.com/a-recknagel/stenotype/issues/3: more concise syntax for type annotation
 
write (int | None) -> int instead of Callable[[Optional[int]], int]
 
thanks
 
I'm curious what dark magycks will be necessary to make int | None not crash with unsupported operand
 
12:23 PM
the same as for most others: string quoting or python.org/dev/peps/pep-0563
or just using (int or None) -> int
 
one and a half hours later I actually get to eat my darn Palatschinken
 
enjoy them
half an hour ago I managed to smear my pizza all over the wall and floor of my oven :'(
it was some crappy deep-frozen factory pizza but I was looking forward to it regardless
 
whoa, how'd that happen?
 
someone was an idiot
 
hahaha
I'll refrain from asking who
 
12:28 PM
you better :P
the person was using the wrong tool for retrieving the pizza from the oven, and didn't notice that the metal shelf in the oven had a gap near the back...
 
oooh :/
 
if said person used the usual tool, or if said person used a tray as usual, or if said person payed a little attention it all wouldn't have happened
 
12:44 PM
Reminds me of the story of the girl who goes on a first date with a guy, and they decide to bake cookies together, and when they're done, he looks straight into her eyes with dead seriousness, says "this is the worst part", and removes the burning hot tray from the oven with his bare hands
 
heh
he was probably disappointed that he was invited over for muffins and there were muffins
 
Fortunately for him it merely causes great pain rather than permanent injury, since he has built up an immunity after doing this many times in the past
 
guess the person here should've done that instead
 
While searching for this, I found 3 different variations of the story with small changes in details ("my boyfriend of two weeks" instead of a first date, etc) so I suspect this did not actually happen.
... Unless: all three did happen to completely different people.
 
It's probably the same guy. He can't maintain a relationship...
and none of these heartless people tell him what oven mitts are
 
12:52 PM
If 80% of Internet users know somebody named Kyle with a passion for punching holes in drywall, then there can be three guys who think third degree burns will impress their date
 
That reminds me: 4 more days until the raid against Area 51.
 
Augh, I was going to prepare for that by Studying The Blade but time got away from me :-(
So much for joining the front line. Maybe instead I'll put on a balaclava and type at my computer under ominous red lighting
Is there a term for a function that returns the same value for the same arguments? It's not "deterministic" because not all deterministic functions return consistent values. It's not "pure" because that additionally implies that the function has no side effects.
 
1:13 PM
What deterministic function doesn't return consistent values?
Stateful ones?
I'd be inclined to call it deterministic
 
Yeah, like itertools.count. Well, ok, that's a generator, not a function, but you know what I mean.
 
OK, so deterministic and stateless?
 
I'm trying to decide whether list.append should qualify for this category. It always returns None, after all.
If it does qualify, then we can't use "stateless"
 
Why? The function itself has no internal state...
it's quite unlike a generator
if you call it with the same list next week it'll do return the exact same thing
of course I wouldn't be so sure if it returned the new length of the list instead...
 
I see where you're coming from but I think we're in murky waters about what qualifies as "state"
 
1:16 PM
a list with the same value would give the same result
if this were probabilistic and physics I'd be inclined to call it Markovian
(but arguably that's just a different way of putting "stateless")
 
It's a very "you can never cross the same river twice" kind of concept
 
Heraclitan?
 
Yeah
 
1:43 PM
Trying to formalize my requirements a bit more, pastebin.com/4BGyNkwS has some test cases
One demerit will be rewarded to the first person to say "well technically it's impossible to make a true random number generator that's free from side effects, because the only source of real randomness in the universe is radioactive particle decay, and by observing the particle you change its quantum state from 'in superposition' to 'collapsed'"
 
collapsed or not, that will still be random ;)
 
1:57 PM
@Kevin referentially transparent is close
unless you consider the side-effect to be an important part of the program, in which case the definition does not make sense. adjusts monocle
idempotent it is
 
idempotent should mean that reapplying it gives you the same result
like a projection
I'm not saying it does mean that in CS, but it should :P
 
according to the all-knowing wiki, it does
 
If I understand correctly, mathematical idempotence requires f(x) == f(f(x)), which might not be the case for all consistent functions. def f(x): return x+1 is consistent but not idempotent.
... But I think computer science idempotence has looser requirements?
I have decided that I do not correctly understand what mathematical idempotence is.
 
2:17 PM
"a magma (or groupoid; not to be confused with groupoids in category theory)"
I hate math speak
 
It's simply a monoid in the category of endofunctors, what's the big deal?
 
that one I actually understand :/
 
Here's my layman's interpretation. "X is idempotent for F" means "F(X,X) == X".
0 is idempotent for addition because 0+0 == 0. both 1 and 0 are idempotent for multiplication because 0x0 == 0 and 1x1 == 1. 2 is not idempotent for multiplication because 2x2 != 2
We can't ask whether any of my test case functions are idempotent because none of them have two arguments
 
in CS, it just means the state after f(x);f(x) is the same as after f(x). consequently, f(x) must always return the same value if no other action happens inbetween.
 
2:22 PM
The identity function is idempotent wrt to function composition as id(id(x)) similarly, string reversal is idempotent wrt function composition as rev(rev(string)) = string
reminds me how there is a id : a -> a in Haskell lol.
 
is id there the built-in function id, or is it some hypothetical function id = lambda x: x?
 
the latter
 
Because almost always, id(x) != id(id(x)) for builtin id
 
Oh I was thinking in Haskell for a second.
 
Is f = lambda x: true_random.random() idempotent? I'm unclear about whether "returns a non-deterministic value, which is immediately discarded" is considered a change in state
 
2:25 PM
@Kevin It is not idempotent.
 
Ok, then "the state after f(x);f(x) is the same as after f(x)" is not a rigorous definition of idempotence, because I would expect "f = lambda x: true_random.random()" to be idempotent under that definition
 
well... wait, I think a lot depends on how you are constructing the random variable.... You say true_random.random() Are you returning an object that satisfies the formal definition of a random variable?
even then, I don't think it would be actually...
 
I don't think "true random" and "state" make sense together. if it is true random, state cannot matter.
 
I've never heard it in that way... I've only heard it in terms of function composition, and I've never heard any mention of state with impotence. I have heard of pure functions vs impure functions however...
 
true_random.random() is a function that returns a truly random float between 0 and 1 without changing any program state, perhaps by measuring the length of time between the decay of two radioactive particles in a chunk of uranium being monitored by a USB geiger counter.
 
2:29 PM
as for "pseudo random" then you actually have f(x: state) = random.random(x), where x is usually hidden by the language
 
Yeah, PRNGs have a little bit of state so I'm avoiding them in this thought experiment
 
quite so
 
I think you're going to go down a rabbit hole.
 
as long as said rabbit hole has more than PERL and Python2, sign me up
 
2:32 PM
yeah, about that...
 
user10984358
heya guys, I have 3 python modules and all off them use various 3rd party imports (selenium, requests_html etc) so I have to create a setup.py so when they (user) run that all these dependancies must be installed, thing is do I have to manually see what imports I have used or is there something that creates setup.py for you ?
 
If you're saying "The Bertrand Paradox is like this conversation because the problem vanishes if you rigorously define all the terms in the question. We're really just arguing about semantics", then pretty much yeah
 
have any of you ever set up a remote project in pycharm? Like it directly executes and runs in the server
 
@TheNamesAlc various IDEs will point out if dependencies are missing in setup.py. PyCharm does, at least. Not sure if there is a tool that straight up write the file automatically.
 
user10984358
using sublime as of now, will look into that
 
user10984358
2:39 PM
so it takes care of everything then? I have not created setup.py's before, so if requests_html needs something else it downloads that as well?
 
I suspect that the "best practice" for identifying dependencies is to develop your modules within an initially clean virtual environment. Then, when you're done, you know that the dependencies are whatever you installed along the way.
I'm too lazy to use virtual environments, so this is speculation
 
user10984358
@Kevin this was what I was having in my mind but with a virtual machine though :/
 
venv is way simpler than a vm though
 
user10984358
Idk why venv didn't come to my mind, so I create a venv and just run this code and add whatever it says not found?
 
user10984358
that works right?
 
2:42 PM
Even if you developed your module in a messy non-virtual environment, you can still identify dependencies by moving it into a virtual environment. Run the module, see what ImportErrors get raised, install the appropriate library, repeat.
 
user10984358
^^^ gonna do that, thanks guys
 
... But now that I think about it, this might fail to identify more obscure dependencies.
 
user10984358
do they have at least the stdlibs?
 
user10984358
how so?
 
Consider a module like:
import BeautifulSoup

if is_full_moon_today():
    import requests
If you run this code in a clean environment when the moon is half full, then you will determine that it needs BeautifulSoup to run
But you'll have no idea that it also requires requests to run when it's a full moon
 
user10984358
2:44 PM
so I have to test all the cases again?
 
@Kevin Yup. Because you have to be very careful when it comes to defining random variables...
 
user10984358
if imports are all at beginning this aint a problem right?
 
Yeah, if all of your imports are at the top of the file at the global scope, then it should be fine
 
user10984358
I don't have to deal with that then but thanks for that snippet TIL+=1
 
... Unless one of the modules does something truly wacky like if is_full_moon_today(): exit() but that's insane
 
user10984358
2:46 PM
lol
 
@TheNamesAlc You only have to require modules you use directly, pip will take care of their dependencies
 
user10984358
bs uses the lxml parser
 
user10984358
but I believe bs4 doesn't do that automatically ?
 
user10984358
I remember doing a separate pip for lxml
 
@Kevin I feel like I saw a recent article where there was an npm module that did something similar but at the same time even crazier than this...
 
2:55 PM
@Dair I didn't necessarily need to use a random number generator for my test cases. Anything non-detyerministic and side-effect-free would do. I thought about using input(), but I didn't want anyone to say "technically, input() has side effects because the typed characters appear on the command prompt and the state of the prompt is part of the state of the program"
For that reason I also considered getpass.getpass(""), which doesn't put characters on the command prompt, but I bet a clever reader could come up with another reason that would change program state
 
00:00 - 15:0015:00 - 00:00

« first day (3257 days earlier)      last day (1682 days later) »