« first day (4190 days earlier)      last day (762 days later) » 

7:57 AM
@roganjosh Sorry, V busy at work at present. OK, they can have the Mac too - and the good news is I've finally overcome the backup disk issue, so now it's "just" a matter of transferring my data and installing the apps I want (there are certain things I definitely want to leave behind this time) and installing a clean OS.
 
 
5 hours later…
12:48 PM
@Ali987 Please see the room rules. In particular, you must wait 48 hours before posting questions from main.
 
Apologies Matt, reading over them now.
 
Lmao, "Python Ouroboros - The Rotating Knives" :D :D :D
Perfect room name
 
2:20 PM
sounds like a movie title
Ouroboros Python, hidden Exception
 
@AndrasDeak--СлаваУкраїні It can indeed. A colleague tried to test some rq code by passing a Mock() as a function argument so he could instrument the calls. Turns out rq pickles its functions, and Mocks won't pickle.
 
 
1 hour later…
3:32 PM
I feel this must be simple but how can I convert a sparse matrix in a list of (row_id, col_id, value) triples. E.g starting with bpa.st/OCZA
 
hey, I'm working on the connection between C# and python and I ran into a lame error.

I cant send a good json data from c#
for example :
c# argment looks like this
arg = "{'id':'123','name':'jack'}"

and it cant be
arg = '{"id":"123","name":"jack"}'
cause C# would raise this error "too many characters in character literal"
then when i tried to load arg into json (arg = "{'id':'123','name':'jack'}") I got this error
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
is there is a way around this ?
 
@graffe ig import seems unused, right?
 
@AndrasDeak--СлаваУкраїні yes it isn't needed for this example
 
OK
I almost missed random too but then I saw the from import
 
It must surely be simple for anyone who knows scipy but I don't fully understand how to use the different sparse formats
 
3:44 PM
Yeah, scipy.sparse.find(S) seems to be it
the different sparse formats are more about ideal memory management for various use cases, the API should be similar
 
can anyone explain what np.int0 does? The context is item 7.b on this opencv link
 
@AndrasDeak--СлаваУкраїні that seems to give three arrays
 
@LoopingDev I'm sure C# has a way of escaping double quotes inside strings, or better yet a JSON serializer.
 
@AndrasDeak--СлаваУкраїні [*zip(list(find(S)[0]), list(find(S)[1]), list(find(S)[2]))] is seems unless there is a more elegant way of writing that?
 
np.stack with some axis parameter then tolist(), but that takes up more memory
@graffe you definitely shouldn't convert each array to list for iterating
list(zip(*find(S))) probably
 
3:59 PM
@AndrasDeak--СлаваУкраїні thanks!!
that's the answer
 
I guess the only difference between np.int and np.int0 is the latter can handle arrays. Just not much in the docs for that
 
hi
 
@Dodge np.int is built-in int, don't use it
It's a deprecated alias
 
okay, thanks
 
is there is a way round it from Python's side ? ^^
I'll look for a way around it on C# anyway
 
4:04 PM
I'd have expected np.int_ or np.intp though
 
have anyone checked out my channel : youtube.com/channel/UCN7Lo2yjOFomJLDpAxxcSMw?🤨🤨
i make projects on coding
 
@Tanay no, and you never linked it here, and this is spammy
 
@AndrasDeak--СлаваУкраїні looks like np.int_ works, that is in the docs so I'll use it
 
@LoopingDev Don't even think of trying. If you want to use JSON, use proper JSON. Using a cobbled together custom notation that almost looks like JSON is a nightmare to use and maintain.
The major benefit of JSON is that it is a well established standard. If you do not stick to that standard, there is no point in using JSON.
 
4:20 PM
Great Advice!
thank you so much, yes I found a good Json serializer for C#
it should do the work :)

if anyone is interested here is the link https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?pivots=dotnet-6-0
 
4:45 PM
hey
anyone here tried algo trading with python?
 
Will be good to know what is it
 
5:24 PM
@AndrasDeak--СлаваУкраїні they removed np.float too I guess for some reason and warn to replace it by float64 or something, wonder what that is.
 
5:42 PM
@AshwinPhadke same thing. np.float is float. Float64 is the numpy double type.
np.float is always wrong
 
What goes wrong when using np.float? I thought int and float were shorthands for "whatever is native here".
 
@MisterMiyagi in dtype=..., yes
Except native is 32 bit int on 64 bit windows obviously
 
Obwinously.
 
The problem is people doing np.float(arr) or doing dtype checks against np.float.
It's just wrong, either you want float or np.float64.
 
Good point.
 
6:02 PM
Oh okay got that now, always wondered why they made that change.
 
 
3 hours later…
9:14 PM
First time scraping a website with CSRF tokens... started out like "I should probably give up", but then reached "Oh hey, it works" before I knew it
 
9:36 PM
cbge
 
10:06 PM
I've been growing increasingly grumpy with the way a handful of people are building our tooling at work, and I've just spotted a comment on Slack asking "What on Earth does this do?". I still don't understand its utility even with the explanation. Is this going overboard or what?
def callback_factory(*_, **__):
      return lambda x: x
"it will return a function, the identity function, no matter what you call the function with" and "It basically means I have no idea how someone (or me) might call this but always return the identity function as the output"
 
The "what" is pretty clear, but what puzzles me is the "why". In what situation can you possibly need something like this?
 
I just don't see any utility for this at all :/ Maybe I'm missing something around context (though it could have come from any of a few libraries where I just throw the towel in trying to understand how they work because there's so much abstraction it becomes tedious
Incidentally, this is the same guy that was thrown under the same bus with me to come up with a 2 hour intro presentation on Python for our Grads for Friday. I should probably start that. He handily gave me his outline of his presentation, which was 100% his own library that uses all this weird crap throughout, then said he was too ill to work on it.
 
Well... sounds like it would be a good idea for him to attend that intro presentation
 
10:21 PM
If today hadn't wiped me out I'd go hunting for all the modules that just contain dictionaries that are called "factories" and show you how bad it gets. It's not even wrong in terms of it functioning, it's just pretentious bull that makes the packages impossible to read
But, hey, I'm not allowed to try my arm with Rust because "nobody will be able to understand or maintain it". In the context of this room, it'd be a stretch for me to call myself a Python expert, but I know a thing or two, and I can't even begin to understand how his packages work...
 
Would it be too passive aggressive to include a bunch of his code in the presentation as examples for how not to write code? :D
 
"Too passive aggressive"? I don't know the meaning of this phrase :P
"Here's some code I randomly <cough> found on our github"
But, on a genuine level, the newer people are trying to set up networks to deal with imposter syndrome and I went on a full rant about it because this guy is making a "model" repo that anyone with some experience would disregard. I don't blame them if they can't understand it, I can't, but it's so over-blown
 
Well. I'd either throw it out and not use it all, or sit down with him and make him explain it. Assuming he's not the kind of person that makes any attempt at communication a waste of time.
 
10:41 PM
That will not go down well. The principle of the main library is sound, but the execution is awful. And he's the person that openly criticises me for bringing in e.g. flask instead of streamlit(complete with "then they don't have to understand HTML <winky-face>"), then writes unintelligible Python. This has fired me up for my presentation on Friday :D
Poor grads. "Jeez, this guy is really passionate about this. What's up with him?!"
 
It's good for the students if the teacher is fired up (:
By the way, you know that saying that you should always write code as if your successor was a psychopath with a chainsaw who knows where you live? For the psychopaths out there, I just want to point out that you don't have to restrict yourself to just your predecessors. Coworkers want in on the fun, too.
 
11:32 PM
@roganjosh I have something like that, but it's called tqdm and used when tqdm isn't installed... So I get the functionality but not the name.
And nowhere near anything I'd show green beans
 
11:55 PM
Hi I've written following code to draw group bar plot.
import matplotlib.pyplot as plt

likert_df.groupby(['Q9_1', 'Q3']).agg('size').unstack().plot(kind = 'bar', legend=True)
I have to add labels and x axis to the graph, Can anyone help me ?
Currently it shown like above, I want to change 1, 2 in label to be formal, informal and Q9_1 to be text value
 

« first day (4190 days earlier)      last day (762 days later) »