« first day (4025 days earlier)      last day (906 days later) » 
09:00 - 13:0013:00 - 21:00

9:41 AM
@rootkit.sys I would imagine that it's as difficult as doing it non-indie. The indie part is a financial problem: you have to fund yourself while you work on a game. So the question is how hard it is to develop a game in python, which probably varies a lot with the game (I'm not familiar with hacknet). But you should know that it's very hard if not impossible to distribute a python program in a way that prevents others from being able to obtain the source code.
 
10:05 AM
@rootkit.sys Is there any specific reason why you would want to use Python? It's probably the least suited of today's languages for game development.
There are tons of free game engines out there that combine powerful compiled engines with scripting languages, in case the latter is your concern.
Even if you want to go most of the way yourself, as you would do with PyGame, I'd rather pick something like LÖVE which supports the much faster LuaJIT. They also seem to have an actual packaging ecosystem.
 
heh
 
10:25 AM
Apparently a year of me saying "we absolutely, definitively can't do this" as the Subject Matter Expert doesn't seem to cut it at work. I've just opened my inbox and the Sales guy is talking to a customer about "Time Slots at Checkout" which is just about the most hideous part of vehicle routing problems imaginable. I specifically said no to time slots :'(
I need 6 PhD students and tenure, then I might consider it :P
 
It's easier to bribe accomplices with money instead of PhDs, just so you know...
 
In reality, the PhD will not avail them anyway. I hope they're assembling a team of experts in compiled languages
 
In a cruel twist of fate, you could put Sales Guy on a PhD program so that they actually learn what is and is not possible. Then have them wageslave for Sales Guy Vol. 2.
What exactly are "Time Slots at Checkout", by the way?
 
I would have hoped that "the last time we implemented this, it cost £6m, took 2 years and required 15 people" would have been enough for them to understand
@MisterMiyagi When a customer wants home delivery, you need to show them potential time slots. Before I worked at Tesco, I didn't know these are actually customised to your location and calculated on-the-fly based on the current scheduled jobs
So you basically have to solve multiple vehicle routing problems in <0.5 secs and it's huge exposure. Especially since this customer delivers on behalf of other customers. Any delays or outages will degrade a 3rd party sales site e.g. some mega-brand clothes store, so the risks are just horrenous
 
That sounds a lot like fake accuracy that won't hold up with reality anyway.
 
10:40 AM
You can actually make these things pretty robust, but you can't just poop out such a system
 
I admit that I don't really have any idea how reliable the real world is. We've given up on scheduling compute tasks more than 15 minutes in advance, but then again you probably don't have roads and cities spontaneously combust.
If you had 6 PhD students and tenure, would you do it? :P
 
Hey people. I am trying to plot data to a bar chart like this: i.stack.imgur.com/TUHQZ.png
 
I know in principle how to build such a system but even my hubris is not enough for me to think I could actually build this without a dedicated team
 
the data is a DataFrame.
                 Subject sub_code  MT1  MT2  MT3
0                  Maths      041   29   37   42
1                Physics      042   36   43   40
2              Chemistry      043   43   45   37
3  Informatics Practices      065   46   48   45
4                English      301   38   40   45
the name of DataFrame is df0
 
Can you show us what you've attempted based on documented examples please?
 
10:46 AM
when I tried df0.plot(kind=bar), I got this: i.stack.imgur.com/TUHQZ.png
in X axis, I wanna have the subject names.. but I am not sure how to do it..
 
you..got what you wanted?
 
Those two graphs are identical?
 
@ParitoshSingh nope..
 
then you need to check the url you linked.
 
@RandomPerson I shared link here for an example of multiple bar charts
 
10:47 AM
You posted the same image twice
 
@RandomPerson this link is the same as the first link. youve pasted the same link twice.
 
something like this:
This is my chart:
Instead of 0,1,2,3,4 in X axis, I wanna see subject names. How can I do it?
I tried to plot the DataFrame using pyplot but I failed. I got this error: ValueError: shape mismatch: objects cannot be broadcast to a single shape
 
df0 = df0.set_index('Subject') before plotting?
 
So you want to set the xlabel of the plot?
 
@MisterMiyagi not the labels.. values on x-axis
@RandomPerson Instead of 0,1,2,3,4 on X-axis, I wanna see Maths, Physics, Chemistry, Informatics Practices, English on X-axis
 
10:56 AM
Did you try my suggestion?
It's not clear to me why you keep replying to yourself btw
 
@roganjosh Thank you it worked :)
@roganjosh to make my point clear to those who did not understand
 
You can just type the question normally without self-pings. We are following the context :) Anyway, glad it worked
 
@roganjosh sure. Thanks for the advice
 
Similarly, you don't need to ping others with every message unless it needs to be clear who you're talking to. You're welcome
 
Can the text be placed horizontally instead of vertically?
 
10:59 AM
you don't want that
 
You could probably rotate it by some degree, but I think "Informatics Practices" is not going to play well being horizontal
 
why so, Andras?
 
Because of what roganjosh said. At worst I recommend a 45-degree angle for labels.
 
roganjosh, if I change Informatics practices to IP, will it be possible?
 
and before you ask how to do that: google it first
 
11:01 AM
It is possible. Whether you like the outcome is up to you
 
Two lines ("Informatics\nPractices") would probably fit horizonally
 
I assume asking that from google would also prove helpful
@CodyGray assuming pyplot can render that correctly (it probably can)
 
Ok Andras.
 
It's just matplotlib, right? Should be no problem.
In fact, I'm surprised horizontal labels aren't the default
 
they are, but this is pandas' wrap
and by "that" I meant the line break in the label
 
11:03 AM
I think in matplotlib you need to enable symbol parsing or something to get it to respect line-break characters
 
pandas gives a nice and easy-to-use plotting API that's usually useless
(speaking as someone who doesn't use pandas)
if you want to change anything you're going to have to use pyplot anyway, so might as well do that from the get-go
 
Life is just easier if you don't use pandas wraps
But, such as it is, we've solved the main problem. 3 cheers all round
 
the random lady still sings
 
who is the "random lady"?
 
11:08 AM
Is it possible to plot this data using pyplot? I tried but I got this error.
 
you probably have to plot harder
 
Can you elaborate please?
 
You have to rewrite the code in a way that doesn't raise that error.
 
can you explain the cause of the error?
 
You have a bug on line 4.
 
11:11 AM
I did not share any code. which line are you talking about?
 
@RandomPerson Hmmm... Do you think that this hinders my ability to debug your code?
 
@AndrasDeak obviously.
 
"Obviously"?
@RandomPerson You've been asking us to debug your code which you didn't show, which "obviously" is a problem.
Do you see some issue here?
 
I do feel that might hinder your ability to debug my code.
@AndrasDeak so you were being saracastic?
 
Nooooo
 
11:12 AM
Obviously.
 
@AndrasDeak It is tough to understand one's intention through text. So please don't be sarcastic.
 
Let's restart. @RandomPerson when you ask for help here, please provide an MCVE.
@RandomPerson I'll try
 
@AndrasDeak sure. I will get back within a couple of minutes.
 
There's no rush. Make it a good one.
 
:)
Actually, I have less time 😅
 
11:15 AM
That is a problem you have to solve. If you cut corners while asking for help you'll get severe pushback here.
Aug 20 '19 at 9:35, by PM 2Ring
Imagine that you won a competition, and the prize is a free session with a Python think-tank who normally charge $1000 per hour. Don't waste that prize!
 
@AndrasDeak Disagree; that'll be absolutely no fun for me. What am I going to do for entertainment tonight?
 
OK, Andras.
 
Hmm, $1000 an hour? There's like, what, maybe a dozen of us here? I think I'm underpaid
 
my cut seems appropriate :'|
@CodyGray pop over to the JS room?
 
Don't be silly, I don't even know that language!
Wait.
 
11:23 AM
exactly!
@RandomPerson Side note, its situations like these where an MCVE is especially important. If time is precious, then you want to waste as little of it trying to explain your exact issue. MCVE is the best way to ensure you help correct help quickly.
 
Ok Paritosh Singh.
This is my code: dpaste.com/BE5P7F4TE
And this is the output: dpaste.com/48T6NKVJ8
 
@ParitoshSingh You should totally drop that and try a min-reprex
 
@CodyGray my brain just spasms out thinking its some kind of regex :(
@RandomPerson this looks promising. could you try to cut out some of the fluff further? specifically you could remove the whole mysql thing. a good MCVE (or min-reprex) should have everything needed for the problem, but nothing extra.
 
@RandomPerson Can we first get rid of the SQL Injection risk of q1 = "SELECT * FROM %s;"%name_of_inp?
Also, as Paritosh mentioned, the MySQL part doesn't even seem relevant to the plotting problem
 
poor roganjosh :P
it's probably a habit spotting those by now, eh? :D
 
11:33 AM
I have a linter installed in my eyes, so I get automatic red squiggly lines for this kind of thing
 
Fine people. I'll remove the other stuff and get back.
 
@roganjosh more people could use one of those, you should open source it
 
@RandomPerson That doesn't mean that the SQL Injection issue goes away btw. Please do look into parameterization
 
@roganjosh Can you let me know why? I have no idea about SQL injection risk.
 
Ugh, I have that for the English language. Red squiggles everywhere. Very irritating. 2/10, would not recommend
 
11:37 AM
@RandomPerson This is probably very relevant for you: explainxkcd.com/wiki/index.php/Little_Bobby_Tables
 
@RandomPerson I think a key theme here is that we're encouraging you to do some research around these issues yourself. I gave you a number of phrases (I even spelt it the American way, despite being British) so you should be able to Google the stuff that you're not familiar with
 
How do you spell SQL injection the British way? Is it just with extra u's? :-p
 
By the way, did university lectures start in the past week somewhere? Just seen 4 freshman homework Q&A on main in a row.
 
@roganjosh OK. BTW, I am not American and also not British.
 
I didn't mean to suggest you were; only that it's the most common spelling, despite it being obviously incorrect
 
11:38 AM
OK.
 
@MisterMiyagi It takes time to get the IDEs set up
 
That looks much better; thanks for taking the feedback on board
 
@CodyGray I bet we could shove a silent k in there somewhere, but I'm not up for such fanciness after a busy week :P
 
11:50 AM
you are welcome, roganjosh.
 
In any case, it really should be parameterisation. I don't know why I capitulate on this word
 
hello everyone
 
can u answer this question please
am really having a hard time,,,please help me out
 
@potatotomato Can you read the room rules please?
 
11:52 AM
@potatotomato hey potato tomato! Please read the rules of the chatroom.
 
In addition to not bringing a question less than 48 hours old to the room, it's rather impolite to just ping me (or anyone else) specifically to answer
 
I just saw it now. am really sorry
 
It's OK. Wait for 48 hours and then try approaching this chat room.
 
That's fine. Just remember that nobody in here is being paid
 
11:56 AM
In the mean time, I would recommend working on condensing down the code in your question to the bare minimum required to reproduce your problem, @potatotomato
 
@roganjosh what are you talking about?
 
Heh
 
@RandomPerson that was to potato tomato, re deleted message
 
@RandomPerson There is no reason to expect that you can walk into a bar, for example, and just hand over some django code problem to the first person you see. You would find that rude, no?
 
I don't think potato tomato tagged anyone in this room.
 
12:00 PM
I don't even use django, so why am I being asked directly to answer?
Actually, you could be right here. I think your ping landed at the same time and I might have conflated the two events
 
@roganjosh yeah. potato tomato did not tag you.
So let's be considerate and make sure that our statements to new users are relevant to them :)
 
@CodyGray I have minimized it again after seeing your recommendation
@roganjosh Am sorry if I make you feel this way. I truly am sorry brother
 
@potatotomato no, it was my mistake, so apologies for linking two different events
 
@potatotomato Please don't say sorry. There was a small misunderstanding.
 
@RandomPerson ok sure thanks
 
12:05 PM
@RandomPerson no, absolutely not. That doesn't have anything to do with SQL
 
@RandomPerson so okay, the main thing i see is that you're sending 3 values, as if trying to plot 1 bar at a time. however, the api actually wants you to give "all" values of 1 type of bar together. So something like plt.bar(X, df0["MT1"]) is what it expected instead
 
transposing the data might plot all of them, never used bar like that
 
i'll be honest, by this stage i';d have personally just used seaborn :P
 
however i did google the rest and you can implement what you need using this bar api like this. the site i found for this was geeksforgeeks.org/… (which is.. unfortunate maybe? but oh well)
 
12:09 PM
ew
 
@potatotomato :)
@roganjosh oh.. ok.
 
@AndrasDeak its spot on. the only other thing seaborn does is that it provides essentially tight integration with dataframes. so it can be a time saver with trying to specifically plot dfs
 
@RandomPerson see here as a starter for 10
 
> Notes
Stacked bars can be achieved by passing individual bottom values per bar. See Stacked bar chart.
ah, hold on, that's stacked
 
ok roganjosh. Thanks for the link.
@AndrasDeak will try that.
 
12:11 PM
no, don't bother
 
what?
 
the stacked example at matplotlib.org/stable/gallery/lines_bars_and_markers/… uses separate bar calls too
And there's nothing in the docs I linked that suggests that passing 2d arrays would group the bars automatically.
 
I don't want a stacked bar chart...
 
I know, but what you want is harder than a stacked chart, and even the stacked chart needs multiple calls to bar
what you need is stackoverflow.com/questions/47796264/… where top answers indeed use pandas or seaborn
 
so using df.plot() is the easiest way to do it?
 
12:14 PM
imo no. i avoid the pandas plot api like a plague
 
+1
 
"Easiest" is debatable. If you already have a dataframe and you're happy with the result of df.plot then yes.
 
my advice would echo Andras's in this case. it's better to dive into some plotting library directly, or you'll need to bash your head against that api every now and then.
for me, personally it was seaborn. (which also meant having to understand at least a bit of matplotlib, but oh well)
 
I don't see seaborn + dataframe to be substantially better than just dataframe.plot
but, again, I don't use pandas nor seaborn so I'm happy to take your word for it
this definitely needs some elbow grease with pure pyplot
 
@AndrasDeak its better in the sense that seaborn's actual API is genuinely kind of nice. they tried to tame the beast
 
12:16 PM
works for me :)
 
Y'all need to just use JavaScript for plotting. ... I'll see myself out...
 
Any pyplot experts in this room?
 
@roganjosh haha. btw, have you tried plotly or bokeh? i've heard a lot about those two
I get the sneaking suspicion Random Person missed my post. :(
 
BTW, shall I ask my question in SO regarding plotting the DataFrame using pyplot?
 
I use plotlyjs for pretty much all my plotting, which I assume will be similar to regular plotly. In general, I need stuff embedded in dashboards
 
12:19 PM
ah yep, plotly will be right up your alley as well then, if you ever had to do it from python
 
@RandomPerson what exactly is your question? "How do I plot this dataframe with pyplot"? Surely that's a duplicate. If you need a grouped plot, see the last question I linked.
and Paritosh gave you code to do it with pyplot
 
@ParitoshSingh They're essentially the same library, but I don't know how much of the interactivity would carry over in the plain python interface. I assume it will launch some window that can handle HTML
 
you got it. it can also embed in notebooks as well
which..is kind of fancy to be honest.
can also produce static graphs, though at that stage you might as well not use the library (well, or maybe they did make some express api, it hadnt existed when i had tried it)
 
I don't use notebooks, so I'm already on the back foot :P
 
oh, i didnt realise that
at the place where i work, its almost all notebooks.
 
12:23 PM
I'd actually rather fire up a flask app and embed the graphs there before I turned to jupyter. I can't stand it
 
@AndrasDeak I don't think that would work..
 
OK, you have to discuss that with Paritosh
 
@roganjosh do you mostly work independently? curious
@RandomPerson oh, did you try running the code? what issue did you face?
 
@ParitoshSingh the same issue which I previously faced..
 
uh...
 
12:32 PM
Until just over a year ago, I basically always worked alone. Now we have a team of (something like) 55 Data Scientists, but I still won't move back to notebooks. Others in the team use them, but then I can't reliably view them in github (it seems to fail to load a lot) and it's not going to go into production from there anyway, so why have the interim?
 
@ParitoshSingh I feel this is the reason: cumsum.wordpress.com/2020/08/30/…
 
I understand their appeal, but it's frustrating as hell when I'm trying to help someone debug and they can't remember which cell needs to be re-run etc. Just make a package
 
@RandomPerson i think youve still managed to miss the message i gave to you earlier.
@roganjosh oh definitely, im actually in the same boat as you, expect my situation is "everyone uses them so it's a nightmare trying to get people to use normal py files. production? what production."
so yeah :P i thought you were working independently thus managing to avoid having to use notebooks for the sake of others.
 
Well that's a big problem with "data science" itself if nobody is thinking about production
 
@ParitoshSingh I did not check the dpaste link.. sorry. I checked the geeks for geeks link
 
12:37 PM
make sure you also read the message i told you earlier just above. it should help you understand what shapes are mismatching as well. (it's basically what the api expects vs what you gave it)
 
The number of people just coming out of a physics degree/phd and claiming to be a data scientist is huge. I can't exactly complain, given that I came out of an engineering degree and did the same - but it's getting pretty tough to make sure that we can roll things out in a practical way. I just happen to be older, to be honest
 
we're currently working on a project that's actually going to go to production. and it's been nothing short of a nightmare trying to get people to give me functions that work outside their notebooks
 
I know the pain
 
Hey folks, will Python calculate a^4 even though it is multiplied by zero?
a = 48
b = 0 * a**4
 
You could time it?
Or use dis
 
12:47 PM
@ParitoshSingh Sure. Thanks a lot for your help :)
 
@ChristophBühler If it does, you should file a bug report with the maintainers of your Python interpreter...
That's not to say that it doesn't, so yeah, you should check.
 
isnt exponentiation higher prio?
 
@CodyGray there's very few optimizations in the interpreter
In [166]: class Weird:
     ...:     def __rmul__(self, other):
     ...:         print('gotcha!')
     ...: 0 * Weird()
gotcha!
 
My gut tells me that the peephole optimisations won't catch this
 
they didnt. it calculates the power
 
12:49 PM
damn
 
You can't assume that multiplication by 0 is a no-op, and it would not be trivial to assert that a = 48 is kept on the next line. Just too many assumptions.
 
@AndrasDeak That's cute. What is it?
 
@CodyGray what is what?
 
because mul can be overwritten, python cannot optimize this away
 
12:50 PM
@AndrasDeak What is that code snippet?
 
it's a custom class that defines a silly "multiply from the left"
or "multiply with me from the right"
 
So you wrote this to test disassembling it?
 
no, I wrote a class to demonstrate that 0 * obj can run arbitrary code
 
@CodyGray that wasnt a disassemble. just a plain old "look ma, it prints"
 
you'd want dis.dis() to disassemble it
 
12:51 PM
Is everything implicitly a double like JS?
 
In [167]: import dis
     ...: dis.dis('0 * a**4')
  1           0 LOAD_CONST               0 (0)
              2 LOAD_NAME                0 (a)
              4 LOAD_CONST               1 (4)
              6 BINARY_POWER
              8 BINARY_MULTIPLY
             10 RETURN_VALUE

In [168]: import dis
     ...: dis.dis('0 * 48**4')
  1           0 LOAD_CONST               0 (0)
              2 RETURN_VALUE
 
gosh thank god no
 
@CodyGray hell no
 
@ChristophBühler maybe a better focus would be on why you're concerned about this?
 
but there's only constant folding
 
12:52 PM
If not, then you can definitely make assumptions about multiplication by 0.
 
@CodyGray I just showed you that you can't
the Weird class I showed returns None when you multiply it by 0 from the left
 
@CodyGray python cannot know the datatype of the objects in an expression with a dynamic variable at runtime, without actually checking it
 
@roganjosh I have a big formula and I am deciding whether or not to split it up with if-statements to optimize performance.
 
So, i wont say that the compiler couldnt be built to handle this, but that means it's an extra check every time this situation is encountered
 
@AndrasDeak You showed me that your implementation doesn't; that's different from can't.
 
12:53 PM
If it were easy to determine that a**4 is a number, python JIT compilation would be a lot easier
@CodyGray no, the interpreter has to accommodate a = Weird() unless it goes to a great length to optimise, which it doesn't
optimisation is usually within an expression, hence "peephole"
 
python opts for a relatively simple implementation
 
to be clear I'm talking about optimising 0 * a**4 in itself
 
@ChristophBühler It might be possible to JIT it away with numba though I wouldn't say I was anything close to an expert on this
 
@AndrasDeak i think this is what Cody Gray is essentially saying tohugh, specifically this nuance "it doesnt go to great lengths to optimize"
 
@ParitoshSingh yeah, because he lives in a walled-off commune called C++
python can't afford to, or doesn't want to, spend minutes compiling a script
3
 
12:56 PM
static languages are infinitely easier to optimize.
it's just a known tradeoff python chose to make
 
it's partly also the complete lack of typing
I think julia has some types, and consequently it also has JIT
 
aye. to be fair python could have a JIT also. heck, rather it does
 
Only for a subset of the language
 
and we've seen that JS can have a JIT, so it's not that JIT isn't feasible because there's no typing
 
and it's not "python", only third-party libraries
 
12:58 PM
pypy?
 
or interpreters
Isn't pypy third-party still?
 
Sorry, I'm still trying to follow this, but struggling with my lack of understanding of why this optimization is not trivial, even for something that is interpreted.
 
@AndrasDeak oh. gotcha
 
Probably because I cannot understand what's unique about the syntax of Weird().
 
@CodyGray you assume that it uses a = 48 on the preceding line, correct?
@CodyGray it's not syntax at all
 
12:59 PM
@CodyGray types. python would have to perform the check for the type of a
 
09:00 - 13:0013:00 - 21:00

« first day (4025 days earlier)      last day (906 days later) »