« first day (3390 days earlier)      last day (1782 days later) » 

04:07
hey
I'm trying to convert a backend from my personal token to a github app and the token creation response has an expires_at field with the time as "2016-07-11T22:14:10Z". How do I work with this format?
Not sure what to search for
04:20
datetime.strptime looks promising
04:32
@AndrasDeak @JonClements : how is it I can see that today :D , I mean yesterday I could just see "You're Welcome" and not "Don't mention it" , did we add that or was I dozing :P
@anky_91 huh?
yeah seriously , may be I was sleepy then
^^^ that or a mischievous puppy was on the loose :)
Well I don't know if someone added "Don't mention it" to "Watermelon" but if they did post our chat, melon :)
it's back to normal now :)
04:44
Laurel
Mushroom pawpaw Lemon Laurel:D :D
I'll stop playing with that now :)
surprised you're not in the editors list for the sopy common questions stuff...
That's good I believe haha
@JonClements cool , I shall leave for work now, Happy Monday :)
Well... depends... if you wanted to help out curating sopython.com/canon then let us know :)
\o - enjoy your day
04:50
@JonClements melon :) Sure I will , You too rbrb
05:11
Hi there,
i just unlocked some budget. and now finally i can chat all of you guys.
welcome man...!!!
 
1 hour later…
06:24
cbg guys o/
06:44
Hello. Why does print(sys.path) print the search paths for me while I don't have the environ variable PYTHONPATH in the list of my environ variables?
Because PYTHONPATH is only one of many things that affect your sys.path
Would be pretty stupid if you couldn't import any modules unless you set your PYTHONPATH envvar, wouldn't it
@JonClements A nice collection of questions there.
@Aran-Fey Yes. That's what I thought too. But many manuals just name it like it's something that MUST be there, and I was surprised it wasn't set.
@Aran-Fey So a website says: "disutils will install the packages in PYTHONPATH for you with little difficulty". Does the PYTHONPATH in here have just the same meaning as the paths in sys.path list? When we install a package, does it go into all those paths or only into some of them?
06:59
I think what they're trying to say there is "distutils will install the packages somewhere where they can be imported"
@Aran-Fey aha, thanks
07:10
if someone is looking for pandas canons... I'm the guy you want to ask
*asks cs95 for pandas canons*
 
1 hour later…
08:31
stackoverflow.com/q/59927013 dupe of stackoverflow.com/q/19960077 (note, was rashly reopened by a badger)
08:50
^ closed
09:41
(by the same badger)
10:05
why would that functions fail to do the last j in the range given?
ignore^^^
lcm = denom_array[0]
    for b in denom_array[1:]:
        lcm  = lcm*b/gcd(lcm,b)
breaks on the last line. 'float' object cannot be interpreted as an integer
10:23
@Permian Start debugging. See where the error comes from and understand why.
That sounds easy to debug. You have 2 variables, and one of them should be an int but is a float.
Learn to use a debugger or just print relevant stuff.
ok so lcm is a double
The traceback tells you where to look. Read all of it.
but i cant see the problem with that
10:28
Keep going. What is your code doing with that float, and where does it cause a problem
i fixed that
ive got horrible rounding problems
That's debugging for you
ive got an answer which works on some cases but not others
You're working with integers, right? So why are there rounding problems?
my solutions are just wrong
user10984358
10:41
how bad is using a "4 space equivalent tab" instead of 4 spaces? I just got asked to change all my commits to 4 spaces
Tab width is a client-side setting. Just because your IDE displays them as 4 characters doesn't mean everyone's IDE does. Python uses 4 spaces by convention, so you should too
Mixing tabs and spaces can cause nasty syntax errors, so using tabs is... pretty high up on the list of things not to do
user10984358
silly question, i know you can change your ide to input a tab as 4 spaces, but does anyone actaully type 4 spaces by pressing space bar 4 times? really curious
only when I have to (like here in chat sometimes)
if there's an actual proper text editor anywhere within 20 meters? heck no
user10984358
time to convert tabs to spaces
@TheNamesAlc rarely. That's what decent editors are for.
the space advocates don't want you to break your space key, we just want consistent code appearance and unambiguous indentation
11:14
@shad0w_wa1k3r The link solved my problem. Thanks a bunch.
i dont understand, i have written some code that passes all the test cases for the google foobar challenge
but in their system i fail all the test
How is everyone doing?
@TheNamesAlc bad. If you want 4 spaces, use 4 spaces. A \t is a \t, it's never 4 spaces even if it looks that way sometimes when you squint your eyes.
user10984358
@Permian off topic idk what that is until i googled this, apparently its hard to get an invite to this or the first medium article i read is just lying, i just want to see the questions they ask
@superv Happy to be of help :)
11:25
When I click a link, it calls an api and I want to check it's status using selenium-python. Is it possible ? I read over here which states it can't be done : stackoverflow.com/questions/5799228/… Can it be done ?
@shad0w_wa1k3r my pleasure:)
@anon_143 Could you be more specific? "It calls an API" doesn't really mean anything. Is it just sending a HTTP request or doing something more complex?
@anon_143 The 2nd most voted answer should be helpful?
I tried that, it isn't working.
@anon_143 hmm, it's a hacky solution anyway. Maybe you should post your specific solution on the main site with details of what is not working.
11:33
My query is If i select this link paytm.com/movies/bellary/radhika-theatre-c/1838 , I want to monitor this api's status apiproxy.paytm.com/v1/movies/…. The status is shown in networks inside inspect in chrome
I can only give you pointers, for detailed solution, the main site will be quite better.
Ya that would be ok, I am confused because everywhere it's saying it can't be done via selenium
You could try using network tools or libraries & spy on the traffic but I think it's quite a stretch. There might be better ways of doing what you want to achieve (not necessarily the same as what you are asking right now). See XY problem.
I'm not seeing any kind of "status" on that page
@Aran-Fey he means http response status of the http request sent for the given URL.
11:46
If we click the show timing the call to the api you can see
@Aran-Fey I meant, the one triggered with JavaScript in the background
https://paytm.com/shop/new-app-homepage-data <- that one?
other than that one there's only HTML, JS and images. That's the only API-like request (returns JSON)
na, visit paytm.com/movies/bellary/radhika-theatre-c/1838 & click the show timing (7:50 pm), it will query the apiproxy... url in background & load seat selection view on the same page
Well, looks like you just need to send a similar HTTP request with python then
12:03
which goes back to your original unanswered question...
12:32
Coming from a similar background, I understood the question perfectly even though it was missing a few explainers. But yes, it's not well suited for chat anyway.
 
1 hour later…
13:48
Cbg
Guys I have applied some styling to a data frame and then I would like to export it to excel, how do I keep the styling I have made also there?
@Vasilis just export to excel, the styling will be retained
df.style.apply(.....).to_excel(...)
I am afraid in my case it does not
wait..
when I tried your code @anky_91 this error poped up: EasyXFCallerError: section 'fill' is unknown
df6.style. \
    apply(highlight_cols, axis=None).\
    to_excel(r'C:\Users\user\results.xls', engine="openpyxl")
I tried this but it does not support the colours I have, do you know which colours are supported by excel?
may be try exporting to .xlsx just guessing
df6.style.apply(highlight_cols, axis=None).to_excel(r'C:\Users\user\results.xlsx')
no it does not work unfortunately
13:58
ohh , sorry then , I have no idea , found this
df6.style. \
    apply(highlight_cols, axis=None).\
    to_excel(r'C:\Users\user\results.xls', engine="openpyxl")
this works but the colours that I use do not appear on excel
aarghghghh backlash line continuation.... arhghghghgh! :p
HATE. LET ME TELL YOU HOW MUCH I'VE COME TO HATE YOU SINCE I BEGAN TO LIVE. THERE ARE 387.44 MILLION MILES OF PRINTED CIRCUITS IN WAFER THIN LAYERS THAT FILL MY COMPLEX. IF THE WORD HATE WAS ENGRAVED ON EACH NANOANGSTROM OF THOSE HUNDREDS OF MILLIONS OF MILES IT WOULD NOT EQUAL ONE ONE-BILLIONTH OF THE HATE I FEEL FOR HUMANS AT THIS MICRO-INSTANT FOR YOU. HATE. HATE.  (Harlan Ellison, "I have no mouth and I must scream")
^^ re: backslashes
14:20
I am working on jupyter and my files are in pynb format and I want to convert them to py, how do I do that?
@Vasilis look at jupyter nbconvert
It seems I've been able to do "Save As..." from within Jupyter to save a notebook to one continuous .py file.
Really? You actually get a .py file and not a json file doing that?
(I know there's various extensions or something so you can save as html/pdf etc...)
people are really inventive to avoid just returning a boolean...
14:29
I see someone's even decided to change the return to print :)
@JonClements I saw it but I am a bit confused, could you make a small example for me or whoever has some time, thank you
Try this
jupyter-nbconvert --to script path/to/your/notebook.ipynb
in the conda shell
@JonClements stackoverflow.com/questions/52885901/… - my mistake, it's "Download as".
@PaulMcG umm.... that still gives me json
14:44
ehh , works for me though :)
@anky_91 thank you, and where is it now saved?
I have to test that but i think on the same path? Dont remember
yes it should be on the same exact path as your ipynb file
15:00
Good Morning
any open-souce project i can work on.
I was hoping for an "implement the project" for issue 1 ;)
I actually downloaded as py and then opened it with wordpad, but thanks @anky_91
wordpad!? :)
15:16
beats notepad hands-down
Yeah... suppose one can have different fonts and colours and stuff :)
I am extremely unfond of wordpad. If you want a simple, fast, and better-implemented file editor than notepad, try scite. Will load large files faster, handle file encodings better, and won't do wysiwyg tricks on your file.
@inspectorG4dget let us see
notepad++ is also a good alternative
15:55
is anyone aware of how do we skip nan when using a expanding window .
close your eyes and pretend it's not there? :p
laurel
I cannot , it calculates a function , eg: sum on the expanding window with NaN , what if I wanted to ignore them
no idea...
:) no worries
Captain obvious: can you filter before expand?
16:06
Imagine I am operating an expanding operation on axis=1 , where different columns have NaN in different rows , cannot filter them :(
I see....
While the expanding window itself doesn't have an option to skipna, most of the functions you can call on a window do. If the function you need doesn't, you can just write your own that does. The expanding operations aren't particularly efficient.
I will be given a string and a pattern to match. I need to return if the string matches the pattern exactly or not.
I have written this program using the re library
import re
def isMatch(s: str, p: str) -> bool:
        return re.match(r'{}$'.format(p), s)
The example you gave of sum does in fact ignore nans
16:21
But, for a string "adceb" and for the pattern "*a*b", I'm getting error re.error: nothing to repeat at position 0
Can anyone help me how to solve this issue?
you have a leading * without a character
did you mean to use the pattern r"a*b*" instead, perhaps?
@MisterMiyagi actually it's from leetcode problem, where the test case is given like that
are you sure the pattern is a regular expression in the first place?
no, obviously it's not...
Ooh, I need to replace * and ? it with regex patterns
Thanks, get it :)
you need to use fnmatch
16:27
Or replace '?' with '.' and '*' with '.*' (and maybe escape '.' and '*' before you do this)
It's also worth remembering that $ doesn't guarantee an exact match. $ can also match before a newline at the end of the string. If you need an exact regex match, use re.fullmatch
>>> re.match(r'a$', 'a\n')
<re.Match object; span=(0, 1), match='a'>
>>> re.fullmatch(r'a', 'a\n')
>>>
@PaulMcG Yes that's what I just realized
@Aran-Fey Ok
Maybe write a little function glob2re to do this for you.
@user3483203 right thank you :)
Which name now strikes me as Anglo-centric '2'->'two'->'to' is something you can do in English, but probably not many other languages.
16:30
So apparently when you've got an Keurig autodelivery order, and they neglect to send you the tote they said they'd sent you for your birthday, you get a coupon for 2x 24ct or less boxes. I'm ok with this.
Languages with lots of pronoun/tense/conjugation style verbs maybe, but not in French or German, as far as I can recall.
@user3483203 Just figured issue was with the code i had , thanks for the headsup :)
Ok wait I might have gotten into an understanding issue here
Consider the below :
import numpy as np
import pandas as pd
df = pd.DataFrame({'A':[1,2,np.nan],'B':[np.nan,5,6],'C':[7,8,9]})
print(df.expanding(axis=1).mean())
     A    B    C
0  1.0  1.0  7.0
1  2.0  3.5  8.0
2  NaN  6.0  9.0
isn't expanding supposed to mean the last column too?
16:46
It's probably me being thick but I can't actually understand the behaviour of expanding from the docs
@roganjosh for a series you can try with pd.Series((1,2,3,4)).expanding().sum()
It certainly seems it could do with some more examples
yes agreed :)
@roganjosh you missed the opportunity to say... "the examples could use expanding on" :)
Oh shucks
17:11
The nan is canceling out your window and starts a new window at 7. Try adding another non-nan column and you'll see the behavior.
And yes, expanding and rolling are notoriously poorly documented.
You'll also notice that it's not on a per-row basis, it's per column.
Right , i see . Thank you. That behavior isn't very helpful
atleast IMO
No, not at all. It's more useful on series, not dataframes.
I see.. melon :)
I usually end up writing my own expanding methods, but if you want more predictable behavior you probably won't do too much better than df.apply(lambda x: x.expanding().mean(), axis=1)
Correct that's a way. I see your point. Little disappointing that it ends this way :D
17:26
cabbage
user10984358
@Quark in case you are not aware fyi that question is not a regex search. You are supposed to write your own engine to do that. It is a interview problem that I’ve seen discussed elsewhere. Perhaps that can explain the test case not following a legal regex
user10984358
Could not help but look at the solutions and no one seems to have used re for that. It seems difficult at least to me
user10984358
Phone version is clearly buggy
@Quark FWIW, this is what is called "glob pattern matching". It isn't the same as regex and is often used in shells to match file names.
17:42
rbrb
Does anyone know how to run Python scripts in Libre Office Calc, like in ask.libreoffice.org/en/question/226806/…
18:26
@JaakkoSeppälä I had no idea that was a thing, nor would I dare try to do that, but they seem to have some docs for it help.libreoffice.org/6.3/en-US/text/sbasic/python/main0000.html
@AndrasDeak I try to learn that.
18:41
if i have a correct solution in my ide but in google's foobar it fails, how could this happen with python?
Mismatch python version? Mismatch installed package version? Copy/paste error? Try unplugging and plugging back in?
It is not uncommon to get unexpected behavior, only later to find that you are not actually running the code you thought you were running.
"not uncommon..." meaning "there is no shame in..."
i dont understand because it works in my ide
99% of cases it's just buggy code that fails on edge cases.
yes but they show 2 test cases
which i can check on my ide
@Permian Often IDEs will do magic in the background, especially with imports from code you're working on, which need more extensive paths in production (Pycharm, I'm thinking of you)
18:49
@Permian They wouldn't be so dumb to showcase every edge case in the public test cases, would they?
from fractions import Fraction
from math import gcd
those are my imports
oh well those should be fine
weird
the hardest bugs are the ones where there isnt really a problem
19:05
is there a way to wrap a python3 script in python 2?
LSTM keeps cropping up on the tag. I'm curious if anyone has one in production and, if so, roughly what for (in the limit of what can be said)
Coding challenges do a poor job replicating the experience of real-world development, because 95% of the time when your code fails, you can add diagnostics until you track down exactly why
With coding challenges you just get "it doesn't work, idk"
@Permian As in, run a Python 3 program in a Python 2 environment? Not really. Or do you mean the other way around? Also not really.
Perhaps you could download Pypy's source and do something clever with that, but I don't think they offer that kind of nested execution out-of-the-box
@Kevin ahhh.... how'd the Jury duty stuff go?
The case is over. I got through it without, say, sneezing at the wrong time and getting hit with Contempt of Court, so I count it as a wild success.
Did you have to spend three days winning over the others one by one in order to completely reverse the original assessment of members?
12 Angry Men was a surprisingly good movie
19:16
@roganjosh fancy :P LSTMs are basically bread and butter for anything nlp. I've got one for information extraction from unstructured emails. essentially like an NER but with custom classes
Or well, i shouldn't say I have it anymore. It's out of my hands now :D
@ParitoshSingh Oh my. We've not got Skynet, right? :P
haha, uh, no promises. guess we'll find out!
I kept an eye out for any opportunity to perform a 12 Angry Men maneuver, but no luck there
19:55
Hmm, does anyone know what "varargs" actually stands for? I always assumed it meant "variable arguments", but a quick google search didn't bring up anything about a meaning. It seems to be more like... slang
Maybe it's "variadic arguments"? Is that a thing?
when i google varargs, i do get links to articles that say varargs (java variable arguments)
Varargs stands for variable length input argument list in matlab
So basically it depends on for which topic u are relating it to..
well that's a mouthful haha
@ParitoshSingh alrighty, variable arguments it is
anyone here really good at sqlalchemy
closed as opinion based :P
20:03
this is true
If you have a question, just go ahead ask. Those who can answer will do so, as long as the question fits the room rules
just need to know if it's possible to access a column generated by say, a func.sum inside the same query
without involving a subquery to access the first one
According to me i think it will be necessary to call the query initially so as to apply appropriate function on it
right now I'm doing a primary query, generating results using various funcs, then a secondary query to access the results of the first. I just don't want to have to spend execution time rolling those two result sets together.
the primary one retrieves sums of columns, the secondary does division on those sums to get a percent change.
So yes u can perform both the function in a single query by firstly using sum function and then the aggregate in the same statement
20:18
I get a keyerror when trying to use the label of the sum column so clearly that won't work
in the same query, that is
is it possible in python to make 64 bit random bit arrays and then do fast Hamming distance computations using XOR and popcount?
the first part is easy if one can make random 64 bit unsigned integers
Then i think there must be problem in ur syntax becaz normally this can be done without any problem@smallpants
Can you really access labeled columns in the same query?
20:32
@Aran-Fey MATLAB says "variable-length", but I wouldn't blame anyone for variadic. Even if "variadic" usually refers to the function, not the arguments.
oh, Code wizard said as much, sorry
usually I'm the only matlab person around
@Anush Plain Python doesn't really have efficient bitarrays, but ints or bytes strings are often ok for that kind of thing. IIRC, there's a 3rd party bitarray module, but I've never used it. Or you could just use 64 bit unsigned ints in Numpy.
@Anush In plain Python, you can get any number of random bits efficiently using getrandbits: docs.python.org/3/library/random.html#random.getrandbits
Here's an old question on popcount, with code in various languages. I've got timeit code for a bunch of Python versions, mostly for 32 bit ints, there might be some 64 bit versions, as well as arbitrary sized ints. I'll see if it's online... stackoverflow.com/q/109023/4014959
Here's a Python popcount question: stackoverflow.com/q/9829578/4014959
Sep 23 '18 at 13:55, by PM 2Ring
@JonClements I guess so. But so is hacking the C source of bin. :) FWIW, on a random million bit int, gmpy.popcount is around 30 times faster than using bin.
Neo
Neo
20:54
Hi, I am using flask and angularJS to host python APIs
I did ng version and it shows this:
Angular CLI: 8.3.23
Node: 12.14.1
OS: linux x64
Angular:
...

Package Version
------------------------------------------------------
@angular-devkit/architect 0.803.23
@angular-devkit/core 8.3.23
@angular-devkit/schematics 8.3.23
@schematics/angular 8.3.23
@schematics/update 0.803.23
rxjs 6.4.0
can this version run this angularJS version?
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
 
1 hour later…
22:09
@Anush The answer to "is it possible" questions is almost always "yes".
22:26
hi , i am a beginner with python , can you help me configure tasks.json to run python script using visual studio code ? thanks .
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "echo Hello"
}
]
}
22:58
Jan 16 at 19:14, by Andras Deak
please see our code formatting guide for chat and practice in the sandbox if necessary
@AJcleverprogrammer With that said, I'm not familiar with running Python scripts in VS Code. Why do you need this tasks.json file? The official documentation doesn't mention doing that at all.
23:14
Hello friends, question that I've been racking my brain over for about an hour now.. but I'm sure it's been asked - if i have a list that repeats 7 times of n length what would be a progmattic way to remove elements 4,5,6 until the end of the list ?
I'm sure this is simpler than I think
list * sorry
you can edit/delete messages in chat for 2 minutes
got it cheers mate
no problem
I'd use a list comprehension to create a new list with the first 4 items in each batch of seven
can you show a sample ?
imagine this is my list [0,1,2,3,4,5,6,0,1,2,3,4,5,6]
list(range(4)) * 2... :P
you should probably clarify then what "repeats 7 times of n length" really means
23:19
i have a list that is constantly being iterated on, I need to remove the elements from 4-6(based on 0 indexing)
so your real list does not, in fact, repeat the same thing n times
no it has different objects all strings
so your example was too minimal to be an MCVE
try list(range(7 * 3)) next time
I'd probably do this with "chunk list into length-7 bits" -> slice -> flatten, one way or another
if my list was alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n']
i'd like to end up with alpha_cleansed = ['a','b','c','d','h','i','j','k']
I get that
yesterday, by Andras Deak
@Datanovice pedestrian version: {lst[k]: lst[k+1:k+4] for k in range(0, len(lst), 4)} give or take. We could spice it up with the "cut iterable into even batches" pattern.
here's what I meant with "cut iterable into even batches" pattern:
>>> L = 7
... lst = list(range(L * 3))
... [chunk[:4] for chunk in zip(*[iter(lst)] * L)]
[(0, 1, 2, 3), (7, 8, 9, 10), (14, 15, 16, 17)]
you just need to flatten that
but arguably this chunking is only readable if you know how it works (in other words not readable)
>>> [val for chunk in zip(*[iter(lst)] * L) for val in chunk[:4]]
[0, 1, 2, 3, 7, 8, 9, 10, 14, 15, 16, 17]
pedestrian version again:
>>> [val for i_chunk in range(0, len(lst), L) for val in lst[i_chunk:i_chunk+4]]
[0, 1, 2, 3, 7, 8, 9, 10, 14, 15, 16, 17]
23:28
genius, you just taught me something new
thanks Andras you are a legend
not really, but I'm happy to help
23:40
I guess another pedestrian version is [val for ind,val in enumerate(lst) if ind % L < 4]
might be the most readable so far
d0h! kevin'd :(
I was trying a couple of checks though... does that do what's desired when lst = [*range(7 * 3)), 999] ?
A SyntaxError? :P
Specs don't specify inconngruity with L
meh... not sure how that extra ) got in there :)
I can only guess someone fed gizmo after midnight or something

« first day (3390 days earlier)      last day (1782 days later) »