« first day (2978 days earlier)      last day (1973 days later) » 
00:00 - 21:0021:00 - 00:00

n8_
9:01 PM
Can someone explain why this returns a ValueError? df2 = df.loc[(df['A'] < 0) or (df['B' < 0])]
 
@n8_ because you need elementwise "or"
 
um... what is 'B' < 0?
 
python's native or is only well-defined for scalars, so numpy array-likes refuse to give you an answer if you try to use or on them
@EKons oops, another good point :D
 
n8_
B is the column header
 
I did find it weird that there wasn't a moderately informative error message
@n8_ cf. df['B' < 0] with df['B'] < 0
 
9:04 PM
that mustn't be it...
'B' < 0 throws a TypeError
 
true, perhaps it's a copy-paste error
 
also... yeah, I'm pretty sure that pandas doesn't like boolean operators applied directly
 
n8_
Ok this worked. df2 = df.loc[(df['A'] < 0) | (df['B'] < 0)]
Thanks
 
bitwise OR :P
 
hmmm, interesting, it sees the first array-like in the logical expression and it throws a ValueError before the second term gets a chance to throw a TypeError
i.e. df['A'].__or__ gets called first
 
9:07 PM
(df['A'] < 0).__or__, to be precise
 
yeah, that, thanks
the original wouldn't necessarily throw
I think...
anyway, it's fixed now
 
so, regarding the AoC 2018 1.2 problem, I just made this stuff:
inp = [*map(int, open('I').read().split('\n'))]
i = cfreq = 0
freq = [0]
while True:
	freq.append(cfreq + inp[i])
	cfreq = freq[-1]
	if freq.count(cfreq) > 1:
		print(cfreq)
		break
	i = -~i % len(inp)
(looks a bit hacky, yeah)
 
I didn't realize you were stuck on day 1
 
I have done a few more days as well, just skipped that star for the time
hm, wait a sec
 
9:11 PM
not incrementing i
there, fixed
but... now what
currently running on another interpreter, still infinite loop
 
just to be sure, are you running for the test inputs first?
 
I'm running for the input it has given me
 
The test inputs usually make it easier to debug your code first. They are small and should always run fast. Real inputs not so much.
so debug first using the test inputs, and then move on to your real inputs
 
it works for the test inputs
maybe I should really wait then
 
I see. Well yeah, then wait, or see if you can make it faster :)
 
9:19 PM
yeah, the latter is what I feel is the evil part of real life
 
it seems you're appending to a list in an infinite loop, which does not sound very scalable
both in terms of runtime and memory
 
@AndrasDeak can you access this link?
 
yup
 
highlighting at the bottom is further attempt to explain.
 
@AndrasDeak not sure if I can change that even a bit, since it's basically what it's asking me to do
legend has it it's still running... :P
 
9:21 PM
@EKons it doesn't tell you what to do. It only gives you a defining algorithm that specifies the problem. It's only fair (and necessary) to compute the same result with less work
initial brute force attempts are good and useful, but if they are too slow/inefficient for the real inputs then you need to go deeper
 
but how else am I going to be able to find out which frequency first occurs twice?
 
@piRSquared thanks, I'll check it out later
@EKons you don't have to keep track of each appearing frequency. How about keeping track of the count of each unique frequency instead?
 
useless? because if any one appears a second time it's the end
 
huh?
oh, I see. I forgot what the problem was exactly
so here's another hint: list.index is slow, set membership testing is fast ;)
 
so, should I use a set instead?
yeah, they don't have the whole ordering hassle, tbf
 
9:24 PM
yes
 
oh hey I actually got a result before getting around to that lololol it was correct
 
There is a big fat list of things that make coders "good". Among those are:
1. Knowing and understanding algorithms and time complexity
2. Understanding data structures and time complexity

If you are unaware of these things then you are in luck. AoC will expose you to these concepts in a trial by fire.
 
also,
1 hour ago, by Andras Deak
@coldspeed watch your memory need, and if it runs for more than half a minute odds are you have a bug/you need to redo it entirely
 
wim
@coldspeed The problems are not hard. It will be a piece of cake for you.
 
wim
9:30 PM
@AndrasDeak There were also a couple of times where the problems were poorly constrained (but it didn't cause errors because the inputs were all hand-crafted enough not to trigger edge cases)
 
yeah, I know that's a major pet peeve of yours
 
over PPCG, we tend to close poorly-constrained challenges... ;-)
 
there was a challenge or two where we debated for days whether a challenge was ill-posed or not in the first place...
 
9:52 PM
I ran into an issue with Day 7 that I'm not happy about. Can anyone clarify this for me?
I may just be reading the question wrong, but it seems vague
 
there's no interruption
once someone is working they don't stop until it's done
or maybe this is what you're missing: 'B' < 'D', and 'F' is already being worked on
 
My solution works, it doesn't dequeue until a job has been done, I just couldn't find anywhere in the prompt that you couldn't interrupt a job
 
well, being able to interrupt would be a pretty strong assumption and would be evident from the test case as well
The fact that the test case doesn't interrupt F is proof enough. Imagine if you're an elf working on a quantum sleigh: would you stop mid-part to start working another part?
 
wim
the AoC examples are gospel. use them as test cases.
I was really hoping someone would solve day 7 with an event loop, but seems nobody did it :(
...no socket programmers in the house?
 
I socket programming
 
10:10 PM
@user3483203 1) If more than one step is ready, choose the step which is first alphabetically 2) Then, even though F was available earlier, steps B and D are now also available, and B is the first alphabetically of the three
 
10:31 PM
Well, I made a start on AoC :)
 
Yay
 
\o/
 
Kevin calls this a "leaderboard". Is there any benchmarking actually done?
 
yaaaah!
 
If I make progress I'll link my github but wondered if there was any set format for func names etc for any automated testing
 
10:32 PM
@roganjosh he doesn't call that a leaderboard
 
Aha
Reading comprehension fail
 
the leaderboard goes with the hash, the sopython link goes with "and/or share your solutions"
you can find a "private leaderboards" link where you can add that
 
Ok, I'll have a look shortly. Got to go out for a bit and only got the first 2 days done, then will have a loiok at the private leaderboard section :)
 
just check that your display name is to your liking, some people have realer names on the leaderboard than here
 
10:50 PM
@wim "not hard" is relative
 
11:26 PM
@piRSquared I had a quick chat with someone else in the same subject, and now I get why what you're doing works. Thanks for the effort
 
I even did it without the looping but instead generating 3D indices. Was a lot of fun. End of work day rbrb. See you guys tonight, maybe (-:
 
rbrb
 
@piRSquared which problem is this?
 
morning cabbage
 
11:30 PM
o/ @ReblochonMasque and rbrb (-:
 
haha, rbrb to you @piRSquared
 
@piRSquared I just started it during my lunch break but didn't make it very far.
 
00:00 - 21:0021:00 - 00:00

« first day (2978 days earlier)      last day (1973 days later) »