« first day (3664 days earlier)      last day (1267 days later) » 

1:13 AM
@inspectorG4dget was telling me about package, which is a new package to quickly build highly interactive web apps/ dashboards around data + ML model. Basically, something like jupyter with a very tight iteration loop which triggers refresh whenever files change (my reaction is, nice, but why didn't they just hack up jupyter itself?) Anyone else here used it? Reactions?
 
 
4 hours later…
5:20 AM
cbg
 
In docs.scipy.org/doc/scipy/reference/generated/… - when we get p value < 0.05, does that indicate distributions of x and y are statistically significant different ?
 
5:59 AM
@YatShan Recommend you read CrossValidated on the Mann-Whitney Test. By the way that scipy manpage cautions "Use only when the number of observation in each sample is > 20 and you have 2 independent samples of ranks"
 
6:57 AM
I regret reopening stackoverflow.com/questions/64545580/…, does somebody want to close as duplicate?
 
 
1 hour later…
8:08 AM
Is it safe to say that when we import a file, a module like x.py with import x the reason why it is run once while executing import x, is so that all the variables and classes will be defined to be used?
 
@CoolCloud This question might be helpful - stackoverflow.com/q/6523791/2689986
 
@shad0w_wa1k3r Thanks !!
 
@YatShan obligatory read to understand the meaning of p-values: xkcd.com/882
 
8:24 AM
Just a general question regarding CSRF token for Single Page Application(SPA). Do we really need CSRF token for SPA?
 
"statistical significance" is not a yes/no question. Deciding on a cut-off on the p-value should be done with respect to the study at hand, and knowing what the p-value represents.
 
@MisterMiyagi so you're saying "yes"
 
IMO the only options are "No" and "Maybe". "Yes" does not show up on my p-value-radio-button.
morning cbg, by the way
 
Scientists thinking they're so smart and they can't even answer yes/no questions
 
Maybe
 
8:33 AM
@AndrasDeak xD
Isn't it incredible that typing 2 characters can make you feel 10 years younger :)
 
 
2 hours later…
10:47 AM
recbg
 
11:33 AM
@AndrasDeak Lol :D
 
 
2 hours later…
1:08 PM
@smci for one thing, Jupyter has a ton of caches but not some of the useful ones that Streamlit has. Whereas Jupyter would otherwise re-execute all the code on a refresh trigger, streamlit has some caching magic that reruns only the parts of the code that are affected by the change (whereas the rest is cached and isn't re-executed). This makes it highly reactive, but is also a double-edged sword as it sometimes goes "stale"
morning cabbages, folks
 
1:46 PM
Hi everyone. I'm uploading some files using <input> element with type = file and sending file over to a flask API for processing which involves at some point, moving the file from fixed source directory to a fixed destination directory in Windows 10. I'm using shutil.move(src, dest) for this.

I'm getting PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: "C:\\path\\to\\source\\folder\\file"

Now, I've used Handle utility (which lists all processes that have an object opened) and it always outputs No matching handles found with inp
 
2:32 PM
Hi, could anyone tell me what a pattern for regex will be for 123-123-123, i was using a code given from this site on a similar problem re.compile('^(\d{1,3}(-(\d{1,3}(-(\d{1,4})?)?)?)?)?$') but yes, i dont know regex
 
you might want to check the pattern on regex101.com
 
question-asking tip: when you need a regex for something, you need to either describe exactly the kind of things you want to match, or give way more than one example, otherwise smart alecs like me will say "just do re.match("123-123-123", s), that will match "123-123-123" perfectly :^)"
 
you might also want to read up on capturing groups, some of those some superfluous or actually detrimental
e.g. the pattern would also match just 123-, which is likely not what you want
 
@Kevin very smart xp, well,exactly is that im trying to enter - at each 5th position like 12345-12345-12345 for total length of 15.
@MisterMiyagi Im fairley new to regex, so I just wanted to copy and use the code from internet just for this regex part only.
 
If you're saying "I want to take a fifteen digit string, for example "123451234512345" and insert hyphens after every fifth character", I'm not sure I'd use regex for that
>>> s = "123451234512345"
>>> [s[i:i+5] for i in range(0, len(s), 5)]
['12345', '12345', '12345']
>>> "-".join(s[i:i+5] for i in range(0, len(s), 5))
'12345-12345-12345'
 
2:39 PM
Actually regex is very small part of the play, regex is used for validation alone. Right here if your wanna take a look
 
Or even just s[:5] + "-" + s[5:10] + "-" + s[10:] if you're 100% certain of the length of the input string
 
@Kevin Oh yes, I see, thanks for the suggestion !
 
2:52 PM
@MisterMiyagi Thanks guys, i was pretty dumb ~ '^(\d{1,5}(-(\d{1,5}(-(\d{1,5})?)?)?)?)?$' is fine for me now. The site has done great help.
 
 
4 hours later…
6:43 PM
cbg, any
 
cbg
slow day all around?
 
Not for me, but it seems like it is for others.
I've never thought I'd get that feeling when the city is silent in a chatroom.
 
Busy day here, which has culminated in "oh dear, it's time for some Java". Currently trying to get my head around what Oracle decided to do with the jdk to see what can be done for commercial purposes now. I take one foot out of the Python ecosystem....
 
6:59 PM
What on Earth makes you need to deal with Java? Eugh...
(Hopefully it's obvious this was a joke :P )
 
hey everyone, i'm trying to get the length of a reddit post. i have a json file generated from its API, and when i try
```for line in sample1:
sample1_length = len(line(['data']['title'])) / len(sample1)```

i get list indices must be integers or slices, not str. anyone able to help? thanks!
 
@BožoStojković Indeed :) I technically could just deploy an executable jar that's been growing moss for years, but the core library it uses has bumped a couple of major versions so I'm taking the time to update for a new project. I just need to understand exactly how to build this now for commercial use :/
 
Oh.. Good luck with that.
@cookiestarninja What is line(...) doing here?
 
i'm thinking that i can get the length by looping over the dataset. is that a suboptimal solution?
(its also a json file, so not using pandas)
 
You're calling line function. Is that a typo?
 
7:06 PM
wait am i not calling the 'line' iterable?
there is no function called line
 
No there isn't, but you're using the syntax for calling a function to index line. Please also see the code formatting guide
line(['data']['title']) should drop the (). There's no guarantee that this alone will fix your code - indeed I can't see how your error actually matches the code you've given us
 
@roganjosh He/she is trying to index list ['data'] with string 'title'. That's where the error comes from :)
 
Ah, of course, that would be evaluated first. Did I tell you that it's been a long day? :P
 
Hehe yeah you did. :P
Busy at least
 
@roganjosh sorry about that, i'll take a look
@BožoStojković sorry could you elaborate on what you mean by that?
 
7:16 PM
No worries - formatting in chat doesn't work like it does on the main site and is pretty unintuitive, that's why we made the guide :)
 
hey guys-
 
@cookiestarninja You are indexing ['data'] list (that only contains a single string, 'data') by using ['data']['title']. What you should be doing is indexing line by using line['data']['title'] without parenthesis. You can't call an iterable (citation needed), you need to use indexing syntax.
"Without parenthesis" is key here.
 
I have a regex expression : r'\d+(,\d{3})*\.*\d*' to convert any “numerical like phrase” into a float.

Its able to identify and convert $17 million to 17000000, $1.25 million to 1250000, but if it’s a single digit such as $1 million, it just converts to 1. What am I missing in this regex expression
 
@BožoStojković thanks! but now i am getting a different error - TypeError: string indices must be integers. i'm not quite sure what this means but i'm reading up on it
 
@jamest that regex seems to match a single digit, so we'll need an MCVE
 
7:23 PM
@cookiestarninja Try just doing print(type(line), line) and see what that actually has in it.
 
or even repr(line)
 
should i paste the formula+regex code here @AndrasDeak?
 
@jamest regex don't convert, they just parse.
 
@jamest Not quite following you there. The regex only matches the number, not the "million" in either case.
 
@PaulMcG <class 'str'>
and line is a very long dictionary haha
 
7:26 PM
Hello everyone. I wish to create a python pie plot using matplotlib.
Is there a way to add specific colors to the pie?
 
So whatever does the final translation from e.g. 17 to 17000000, and should convert 1 to 1000000, is not that regex.
 
its a 2 part regex, second part converts the "million" into a float number and multiplies the first number
 
No, it looks like a dictionary, but it is a str. Perhaps it is JSON, and you can use json.loads to make it into a dict.
 
correct, might be easier if i share the code, but didnt want to bog the chat
 
@jamest Well, then we need both parts to help you.
 
7:26 PM
okok!
 
@cookiestarninja Next step is to see what line['data'] is I guess.
 
@jamest Take a look at the code formatting guide if you haven't already. Long pieces of code are ideally hosted on some code pasting service, e.g. gist.github.com
 
@Broxigar Did you actually parse the JSON? Did you use e.g. json.load?
 
7:29 PM
yup. just shared, the func is money_conversion()
 
@cookiestarninja This tells me there is an error on a different part of your code. Can you check the traceback?
 
@MisterMiyagi wrong ping
@Broxigar hello. Probably. Did the docs give any hints?
 
@BožoStojković its on that line though
 
Hmm.. Can you post the whole line?
 
all i've done is read my json and save them into a variable
 
7:31 PM
I just found the color parameter on the docs of matplotlib. @AndrasDeak
@MisterMiyagi, these data came from a csv.
I am preparing a gist as @MisterMiyagi suggested.
I will share it here shortly.
 
@BožoStojković updated the codeshare link
 
@Broxigar Sorry, pinged the wrong person. :/
 
I figured, no worries
 
@Broxigar so I'd try looking at that
 
@jamest The issue is in your number matching regex, which appears to be a bit more complex. You can check it on e.g. regex101.com
@cookiestarninja Did you actually parse the JSON? Did you use e.g. json.load?
 
7:35 PM
It doesn't seem like it from the code he provided. He is reading JSON files with .readlines()
 
hello Its my first time here
 
@cookiestarninja You might want to check out the json module documentation
 
@BožoStojković i think that might've been the problem - now fixing utf-8-sig issues. will get back to you :) thanks!
 
JSON itself is just a string, like source code. You must tell Python to explicitly parse it using e.g. json.load or json.loads. This will give you the expected Python objects, e.g. lists, dicts, numbers and so on.
 
Okay, I created a gist
In this pie I need some custom colors
Do I just create a list and add it as colors = my_custom_color_list
 
7:44 PM
@MisterMiyagi @BožoStojković fixed!! thank you so much for your help :))
 
@Broxigar you said you found the color parameter in the docs. Why not try to use it?
 
I am unaware of how colors are specified
are they strings? do I have to specify them in an rgb way?
seems they are just strings
okay, that was convenient
 
My contribution to society today: github.com/streamlit/streamlit/issues/…
 
@tripleee Will do, but the target you chose Python: Find substring in list of string is not very clear and not great; it mentions unicode, which will confuse some, also doesn't say about case-sensitivity.
 
@Broxigar matplotlib is very forgiving with colours. You can use strings, hex codes, rgba tuples etc.
 
7:52 PM
interesting. !
 
@Broxigar: what AD said, also the Matplotlib list of named colors should get you started: matplotlib.org/3.3.2/gallery/color/named_colors.html
 
Much appreciated guys.
 
@inspectorG4dget I hate it when they say "I restarted X and now it's fixed. Thanks!" and that doesn't fix it for me because they probably did other things as well.
 
@Broxigar If you look around the web, there's all sorts of 'colorbrewer' apps/lists to give you a custom palette within given RGB coords, etc.
@roganjosh Is that an API legal question or a software question... half-seriously :p
 
@BožoStojković one of the problems was that the Streamlit docs don't have a "release history notes" section. So it's not particularly easy to figure out when a feature became available. Another silly problem was that PyCharm wouldn't upgrade my streamlit - so I thought I had the latest version when in fact I didn't. I had to yammin' uninstall and reinstall the package </rant>
 
8:00 PM
Anyways, it's nice of you to put that comment it. Someone somewhere sometime will appreciate it a lot. :)
 
I certainly hope so :)
 
@Kevin for you and anyone else who has spare mental energy, Puzzling.SE: Make 11 from five identical digits for each of 0..9, using +-*/^!,SQRT,SQuare and (). Seven is quite tricky...
 
thanks @MisterMiyagi for the regex link
unfort im still at a loss.
 
8:25 PM
@smci The library I need to run is licensed perfectly fine for commercial purposes. Oracle made several changes to how they distribute updates to the Java runtime to actually run the library, which means that for commercial purposes, you need to pay them a license. But it seems that the announcement is coming across somewhat bellicose and there are open ways to get around it
I remember it being really controversial but it was all in my periphery until now when I want to deploy on a commercial server. I think I've found a way around the issue (without anything underhanded, just getting around all the a) primary search results dominated by Oracle and b) Ignoring the consultancies that have sprung up just to advise on the issue). In any case, it's just me grumbling more than anything :P
 
@jamest Your word_re is to blame.
 
@inspectorG4dget Whoa. Did you file a bug on PyCharm? That sounds worth publicizing. (Was it that the package upgrade silently failed?) We're not here for an argument, we're certainly not here for an argument with an IDE, esp. when it's wrong... :S
 
@smci It actually silently succeeded - it told me that the install went just fine, but didn't upgrade anything. There is an "options" input box in the interface, which I might be able to use to inject a -U, but I haven't tried that yet. It's after that experiment that I'll be able to file a bug report
even the install log showed a successful install
 
@inspectorG4dget Sure but please do file a bug. That really is unacceptable. At minimum it should warn you "Tried to update Package X but failed" in big red letters.
 
yup. I'll do that later today
 
8:33 PM
@smci As to this, I think there are some relatively large distinctions in how extensible things can be without jupyter. Reliance on the ipython kernel and its inbuilt server probably isn't very extensible; streamlit is running on tornado as the primary server. I'm seeing the exact issues of my current place launching a dashboarding stack using Shiny and ShinyProxy that just totally breaks simple Flask apps
 
@roganjosh How much will this be affected by the pending US SC ruling on Google v Oracle plus the antitrust(s) against Google and other big tech?
@inspectorG4dget Trying to install an already-installed package and not -U upgrading to a more recent version is a fail (yes even if pip cheerfully reports the install 'worked'. Should assert the package has the newer version number). It might depend on the user and permissions used to originally install, and if that was a manual install outside the IDE or other package mgr. But, it needs to get this stuff right, or at least catch fails.
 
Honestly, I'm not even vaguely in a position to comment on that. I just finished work and thought "oh, I seem to remember something about Java being different now" so the sum total of my research has come from tonight, and it's just focused on getting my old library into line to pass an audit, should it come :)
"my old library" being tagging a socket onto a script that communicates with the library that actually does the heavy-lifting. My own Java is pretty poop :P
 
@smci actually, pip install already_installed_library will result in "already installed!"
 
@roganjosh Sure, just people have predicted all hell will break loose in API-land if the pending US ruling is a legal mess.
@inspectorG4dget Uhuh, but then asserting the package has the newer version number should fail.
 
@smci you're absolutely right. I'll file that bugreport later tonight
 

« first day (3664 days earlier)      last day (1267 days later) »