« first day (2832 days earlier)      last day (2113 days later) » 
02:00 - 20:0020:00 - 00:00

2:36 AM
Anyone using flask?
with sqlalchemy?
 
 
4 hours later…
6:49 AM
I have used it in the past
cabbage
 
7:23 AM
cbg
 
anyone know LightFM library for recommenation
 
7:51 AM
Good day :)
 
cbg
 
8:37 AM
nice, repcapped already for this day...
and not a single rep from :F
 
Anyone using robotframwork?
 
8:57 AM
@AnttiHaapala Nice QA on with := ..: vs with .. as:. Another difference between the two would be that the variable in with .. as still exists after the with block, and it doesn't in the with := ..: case.
Then again, using the passed context after exiting shouldn't make a lot of sense.
 
9:17 AM
@Arne are you sure?
I thought asspressions persist one level above
 
I'm fairly sure, but am currently rebuilding my py3.8 env to test it.
 
I built the proof-of-concept branch in the PEP but it doesn't even leak names from list comps, so it's not representative
then again there was an error near the end of the build so perhaps something is missing...
 
And another incorrect and misleading page on Python memory management is, thankfully, gone: github.com/Theano/Theano/pull/6621
 
9:33 AM
@MartijnPieters is there one you'd recommend?
Also, cbg
 
@Arne it makes plenty of sense.
 
Hi i'm a beginner in python and I want clarify some things and know if my understanding is correct. `from reportlab.pdfgen import canvas`
reportlab is a library
pdfgen is a module of that library? or is it a class of one of the modules?
canvas is one of the methods of a class?
 
@RobertGrant recommend what?
 
@MartijnPieters wow nice issue there github.com/Theano/Theano/issues/6619
 
cbg
 
9:35 AM
cbg
 
@MarcSantos reportlab is a module and pdfgen is also a module. canvas can be a global variable/constant/whatever in the pdfgen module or a module.
 
I've just been bitten hard by pd.read_excel() :/
 
despite their non-venomous quality and tranquil natures, pythons can bite
6
 
All of the values in my rows are completely misaligned with the values in Column A with no rhyme or reason I can see. Some values are several rows lower than they should be and some are several rows higher so I don't even know where to start
 
@roganjosh start with isolating the neighbourhood of offending parts
 
9:39 AM
It's every row lol
 
@Aran-Fey so canvas can be a class of the pdfgen module?
 
are you sure you aren't just looking at a very long line that overflows in the terminal or something?
 
@MarcSantos Yes.
 
@Aran-Fey I believe a library is a combination of modules and every .py file is considered a module. Isn't reportlab a library by definition?
 
Depends on your definition of "library". Would you consider a python module that formats your hard drive immediately when you import it a "library"?
 
9:42 AM
Well I just read what people said here: quora.com/…
I'm just confused reading literature when I don't know what to call those things
 
@MartijnPieters Do you have an example for me where the context is usable after exit?
 
@Arne TestCase.assertRaises().
Or some database connection objects, where __enter__ returns a cursor object. The cursor is still useable even after the transaction has been committed or aborted.
 
@Aran-Fey I think I get it now. So reportlab is a module and it directs to all related modules
 
oh no, I wrote one of those today.
should have known =D
 
@Aran-Fey and canvas is some object in the directed module
 
9:45 AM
My personal definitions:
module: something meant to be imported
package: something meant to be imported, and it consists of other things meant to be imported
library: something meant to be imported
^ mostly interchangeable, the 3 of them
 
Right thanks
 
Hi everyone ! I got some question regarding git, especially Gitea and GitHub client. Would someone be kind enough to accord me some time :p ?
 
I'm curious if anyone has seen something like this before? the original excel and what pandas made of it. All the rows are scrambled and some values are just flat-out missing
 
I don't know if I can aks my question straight away here as that's not related to Python at all
 
@Will yeah, we prefer that people don't do that, sorry
 
9:46 AM
there could also be value in still having access to the old decimal context, to introspect the context setup even though it doesn't apply anymore.
 
any chance it can be on topic in another chatroom, or one on chat.SE?
 
I've looked at the different room, couldn't find any related to git :/
 
gitea has never been mentioned here, so your chances are pretty slim anyway
 
you score a point, sadly x)
 
I appreciate your concern for being on topic and I agree that there's no good place to ask, so if you feel desperate enough I think you can ask away if you can be on-point.
 
9:49 AM
@MartijnPieters Given that I am right about assignment expression in conjunction with with-blocks leading to NameErrors after exit, that part should imo be added to Antti's QA
 
ah, also, assertLogs.
 
I am "just" trying to get the GitHub client to work with Gitea rather than the GitHub plateform
 
@MartijnPieters a page on Python memeory management
 
Do you have to do a pip install [module] for each project that you make? I just noticed the site-packages are local to the project's folder
 
@RobertGrant ah, no, I don't have a recommendation. I haven't looked much, but the ones I've seen are all rubbish.
 
9:51 AM
Ah okay. Someone like me would read something like that and assume it's right, so it's always good to fish for recent recommendations :)
 
@Arne uhm, name errors? with ass_expr_name := <expression> as target_name: should not lead to any name errors after the with block.
If there is a name error that would be a bug, the PEP clearly states that ass_expr_name is a name in the current scope, which is the same scope that target_name is bound in.
@RobertGrant which is exactly why I asked for it to be taken down :-)
 
Yeah, much obliged
 
@Will when you say github client do you mean github.com/desktop/desktop?
 
Absolutely
 
because you should look at their issue page, such as github.com/desktop/desktop/issues/5103 linking to github.com/desktop/desktop/blob/master/docs/integrations/…
I'm not sure that's directly applicable (probably isn't) but the info you need should come from them
try searching for connecting to gitlab or bitbucket, as those are much more popular so you have a larger chance of finding a solution
 
9:59 AM
@MartijnPieters Then I guess I'm wrong. I'll test it anyway and learn a bit about scopes.
 
@Arne does it?
 
Yeah that's a good idea, thank you
 
@AnttiHaapala Probably not
 
Scopes: there's only the module scope and function scope, and class bodies are executed as a function but with some adjustments to how its scope interacts with others (specifically those of nested scopes). Comprehensions (list, dict, set, plus generator expressions) are really function scopes too except for the initial iterable that's passed in.
(See stackoverflow.com/questions/13905741/… for an example where class scope and list comprehensions can clash)
@AnttiHaapala it doesn't.
 
Well, the issue is definitely in xlrd, pandas is just innocently reading the bonkers output it's giving :)
 
10:37 AM
@AndrasDeak I managed following your tips, thank you again :)
 
10:52 AM
I'm glad to hear that, no worries :)
 
@roganjosh or with XLS...
 
I haven't been able to track it down, but the other issue is that the whole company runs on spreadsheets and lots of them, so I can't control the excel file
I can fix it if they use excel to convert to a CSV beforehand but there's 14 sheets and they change frequently, so it's an ugly way to interact with my code
What's most strange is that I get dates in the row I expect to find them, I get product codes and column names in the columns I expect to find them, and numbers in the cells I expect them, just completely jumbled up
 
11:15 AM
Spreadsheet-based company :D
 
Yep. And this is a really serious issue because I'm trying to plan a production schedule for the whole factory and there is no way to cross-reference what pandas read with the initial file other than manually. Major problem :/
 
XLS: you're doomed no matter what â„¢
 
11:31 AM
hi,
I'm using `asyncio.start_server` and made a `concurrent.futures.ProcessPoolExecutor(max_workers=10)` as `executor` of it. executor works perfectly but when its works finished it won't let `start_server` to close writer.
how could I manage it?
I've searched everywhere but didn't find anything helpful. they told to make an executor in every asyncio coro but it makes a lot of subprocesses and will make cpu overheat.
 
hmm wat...
 
We're going to have to go with the CSV method. That's really spooked me though that such a thing can happen and it's impossible (unless I rewrite my own full Excel parser) to catch it with any logical test
 
12:25 PM
Lol, predictably there's a sensible reason. The version I was shown had all the other rows "sorted" by column A, which doesn't actually rearrange column A in ascending order and they hadn't saved the changes.
 
12:49 PM
Seems I can't test my assex hypothesis, I can't get the PEP572 proof of concept to build any more. No matter how I try, it always ends with a ValueError: generator already executing, Makefile:618: recipe for target 'sharedmods' failed =(
 
1:29 PM
\o cbg
 
cbg Mooing
 
I find the type of question where OP "wrote the code but doesn't understand it and need a step by step guide on what it's doing" kinda weird. I understand sometimes we write code and more often or not, we don't understand why it works but it works, maybe it's a case of that but with just simple for loops and new syntax, but if it's new syntax how did they write it in the first place without reading about it :\
 
1:47 PM
hello
 
I can understand the idea of "I just read about this language feature, and I'm going to try random things with it and see what it does" but I can't get into the headspace of "I got something that runs, but who knows why it's doing what it's doing... I know, I'll ask SO to explain the concept to me from the ground up".
There are a plethora of tutorials online, written by professional authors, which have a hundred times the explanatory power of whatever gets regurgitated in fifteen seconds by the fastest gun on your post
Maybe their reasoning is "I don't want to look at existing tutorials, because they explain how async def foobar works, and the code I've written is async def trozzort, and there's no way I'm going to be able to generalize the information conveyed"
 
@idjaw o\
 
My special snowflake code requires an equivalently special snowflake explanation
 
^
 
hey @AndyK
 
1:59 PM
Sometimes the code they've written really is more complicated than the toy examples you'd see in a tutorial. But a lot of the time that complexity doesn't serve any purpose -- it's just there because it's the first thing they tried that works, and they didn't necessarily try things in ascending order of complexity
But even in that case you might expect answers to be of the form "you didn't really need to triple-nest your functions here, so let's strip that out and work from a simpler toy example..." and then the rest of the post is no better than an existing tutorial
So they're still not getting the handholding they desire
 
2:51 PM
rb folks
 
morning cabbage
 
rhubarb, cabbage
 
I finally did it. To the surprise of noone, Martijn is right. If statement, while loops, with blocks.. all leak the assex variables they declare.
My disappointment is immeasurable and my day is ruined. One of the main reasons why I was looking forward to 572 was to conveniently mask variables and reuse their names without running the risk of shadowing them.
 
assex?
 
I could probably invent a scenario where you'd want the leak to happen, but my heart wouldn't be in it
@Code-Apprentice "assignment expression" presumably
 
3:00 PM
so now we are coming up with sexy abbreviations for the thing that drove out Guido?
 
@Arne But if statements, while & for loops, and with blocks don't create a new scope, so why wouldn't they leak anything you define in them?
 
In short: because that's what i wished they did
I understood the usage of the word 'block' in the pep that way, and assumed the author did some magic to create mini scopes
@Code-Apprentice just trying to improve on AD's asspression =/
 
*asspression, please
 
@AndrasDeak my bad, fixed. Never meant to misrepresent
 
3:15 PM
Also I think they started out as scoped names, "statement-local names" or something in the original discussion
But then the Fire Nation attacked people refined the PEP
 
o/ I'd like some advice on how to proceed with a question (it's a bit too python specific for us to provide a definitive answer in SOCVR): I feel like this should be closed, no MCVE? no repro? off-topic->other? I don't know, but I don't think it's an answerable question beyond what's been said in the comments. Thoughts?
 
Only a dupe I think
It is answerable, see the answer
 
@AndrasDeak Yes, but it seems from the comments that this has already happens, they're aware of how to avoid the problem in future, they want to fix the past
 
Yeah, the answer is probably "not possible to do"
Still an answer
Lot of magic going on in ipython, so not entirely trivial
 
I agree that it's an on-topic question
 
3:26 PM
Alright, thanks for the input @Aran-Fey @AndrasDeak
 
no problem :)
Perhaps a dupe to references and name binding in python...probably iffy
 
afternoon cbg
 
Cbg. Anyone got a canonical dupe for this? If so, a golden tag badge could also be helpful...
 
Seem like a fair response?
 
unclear stackoverflow.com/questions/51405259/… It's probably a "variable variables" question, and it's attracting bad answers.
@ArtemisFowl I don't want to dupe-hammer that, it's not clear what the OP did to cause that problem, so any dupe would be a wild stab in the dark. But I'm happy to close-vote it as unclear.
 
3:46 PM
Seems reasonable. Ijust spent the last 10 minutes determined to find a way to get the variable value back. Something about it does feel plausible to do
 
@PM2Ring The answer in comments answers it, it's caused because of a lack of import statement. Surely there's a dupe for that?
 
@NickA almost, but it's the name that was rebound (minor lingo thing) nedbatchelder.com/text/names.html
The original result was probably instantly killed
 
@AndrasDeak "You've overwritten your variables value" -> "You've rebound your variable to another value"?
 
Before I make myself look super foolish.... the value is still stored in locals() for me... am I seeing this right?
 
locals() would store var but that would point to the new value, there wouldn't be e reference to the old one surely
 
3:50 PM
You can see it there
 
@NickA the name var was rebound to a new object (the list) and the original was lost (lacking any references)
 
a = 6, which is the result of sum([1, 2, 3])
I completely reset my session beforehand and defined a 3 times
One of which is the result of a function call
 
Yes but what happens if you do a = [1,2,3] followed by a = sum([1,2,3]) can you still get the result [1,2,3]?
 
It might help if you assign the same variable to two completely different values in order to really determine what is going on.
 
3:52 PM
One min, restarting kernel again
 
Do something more substantial
 
I'm going to inform the OP anyway, they may only have done 1 more assignment
 
a=np.exp(1j*np.pi); a=[1,2,3] -> can you see -1 in the locals?
 
I'm confused about what's going on here
 
And I'm on mobile
 
3:55 PM
I can't see the result of np.exp(1j*np.pi) at all in locals
But there are multiple records of me making the function call
 
Tge first expression gives -1+0j
@roganjosh but you need the return value
 
Yeah, that isn't in locals() even though it's the last value I assigned to a
Yes, I did a=np.exp(1j*np.pi) sorry
 
The history string is useless
 
... that is what I am saying
 
@AndrasDeak Updated, do you want a mention?
 
3:57 PM
@roganjosh you're confusing me
@NickA I;m fine, thanks though
 
a = (-1+1.2246467991473532e-16j) isn't even shown in locals
 
@NickA I'm fine, thanks though
 
Even though that's the current value of a
I have the history string of making the assignment, but not the current value
 
Ah, cool, that's what I'd expect
 
Right, I'll leave you to it, have a good night all, ta for the help
 
3:58 PM
The reference us only bound to a
 
rbrb Nick
 
Night, Nick
 
Well, if I do a = sum([1, 2, 3]) I see both that and a=6 in locals
 
To me, it's only 5 o'clock. Time zones...
 
So why not after a numpy call?
I need to read about what it's doing. locals in the iPython console is flat-out confusing me
 
3:59 PM
@roganjosh is 6 really from there?
 
Yes, I rebooted the kernel before doing it
And checked locals was empty
 
And not from another expression printing a?
 
Well, that a wasn't in it at all
 
OK, I'll check later from laptop
 
I don't want to end my working day on this conundrum :P Anyway, rbrb for a bit
 
4:02 PM
how are there no questions for [table] since Dec 8, `15 except for 3 within the past hour??
 
cbg
 
cbg
so, following a pluralsight formation, I've now started working on python parts of projects at work. that is a very refreshing change from javascript hipster frameworks
 
4:19 PM
@ArtemisFowl I guess it could be a simple lack of import, but it could also be a couple of other things. The OP didn't clarify whether or not they did import turtle, but "I've already checked my module name which ismydesign.py" implies they've read about the problem that happens when you try to import a module from a script with the same name as the module.
OTOH, doing import turtle; turtle.forward(10) wouldn't raise NameError, it'd actually open a window & do the correct drawing operation with the default turtle. So maybe it is a simple lack of import. :)
 
brief cbg
 
4:32 PM
cbg
 
@PM2Ring catching up on this, that looks nice! Thank you!
 
5:05 PM
Hi Guys
why is this true?
x = "Christian"
y = "Naumann"

if x and y in "Kerstin Naumann":
    print("foo")
in the and clause it should x and y in the string, or?
 
what you have written is "if (x) and (y in ...)"
when I imagine what you really want is "if (x in ...) and (y in ...)"
 
if x in "Kersin Naumann" and y in "Kerstin Naumann":
    print("False")
This is working
but why not the first example?
 
2 mins ago, by MoxieBall
what you have written is "if (x) and (y in ...)"
 
x = "Christian"
y = "Naumann"

if (x) and (y) in "Kerstin Naumann":
    print("True")
 
it's basically how boolean statements work; the "and" divides the condition in two statements. if (x) and (y in ...). it resolves x as truthy (eg not an empty string) and (y in ...) as true (y is in ...)
truthy and true === True
 
5:15 PM
ah nice. thank you+
 
what's a good way to map() over a list and create two items in the output list for each item in the input list?
 
How about:
>>> [item for tup in [(x**2, -x**2) for x in range(5)] for item in tup]
[0, 0, 1, -1, 4, -4, 9, -9, 16, -16]
 
I was just about to say there's probably an overly clever way to use tuple unpacking on that
 
wim
I like better
>>> [x for n in range(5) for x in (n**2, -n**2)]
[0, 0, 1, -1, 4, -4, 9, -9, 16, -16]
 
There were no table questions for the last 3 years because this dude deletes all of them
 
5:26 PM
42,000 posts edited, woah.
 
... yeah. rarely does these numbers actually indicate something good
 
Yeah, that's some dedication right there. I'm pretty sure he's almost singlehandedly gotten rid of ballpark 18k table tags
 
unrelated Python news....I saw Radiohead last night, and they reminded me why they are still so huge after all these years. <3
 
Apparently Brian is known on meta as the reason they don't have to deal with , and his edits are largely useful. Score Brian: 2, effectively managing tags: 0
 
5:43 PM
@idjaw weren't they in Montreal last night?
 
yep
 
sup fellow Montréaler
 
word up :)
 
nltk model predicts @idjaw was a teenager in the 90's
 
here we are now, entertain us
 
5:53 PM
smells like the 90s
 
FYI - My age is based on my manufacturing date from the LEGO factory
 
Hey have any of you guys read "Deep learning with python"
 
nope
 
That one of the gazillion books on humble bundle?
 
I just feel deep in a pit of failure and climbed out with knowledge
a lot of scars and bruises
some will never heal.
 
5:55 PM
I got it from amazon so im not sure if its on humble, but I had a question on their usage of python
 
I just came out with the scars and bruises
 
they put in a line of code then afterwards use >>> [something with the code written]
as if it was just in the command line not the actual py file
And I was confused on how to do that
 
>>> is generally sign of the REPL
 
yeah. @oso9817 When you enter the Python interpreter, that's the "prompt" symbol you get to enter your commands
in your terminal, just type python and you should be taken to it
 
Yeah I know how to that but how does he do it where it ties in with the code he wrote? He uses a variable not defined except in the py file
 
5:57 PM
also, the other day I learned that REPL stands for Read Eval Print Loop and my world changed.
 
meaning he should get a syntax error if doing it in the terminal python interpreter
I'll type it out on pastebin rq
it should be train_images.shape
 
I'd hazard it's assumed that the module was imported before running the command
 
yes
exactly.
They did not say it explicitly, but the exact commands would most likely be
>>> import name_of_module
>>> name_of_module.foo
where foo exists as some method or variable in name_of_module
 
That sounds about right. thanks
 
recbg
@oso9817 Another option is to do python -i some_script.py, which runs the script and then puts you into interactive mode.
 
6:09 PM
Thanks ill check that out
 
@PM2Ring that's interesting. from there __name__ is still __main__
 
@FélixGagnon-Grenier I've never checked that before. But it makes sense, since it's just running the script like python some_script.py does and then going into interactive mode. It's not importing some_script.py as a module.
 
no, yet definitions are visible in global scope once in the interactive shell
def go():
    print(__name__)
>>>go()
__main__
 
TBH, I've rarely used the -i option. Another thing that can be handy is to put the name of a startup script in the PYTHONSTARTUP environment variable.
I used to do that to get readline tab completion in Python 2 interactive mode. Python 3 gives that to you automatically.
 
6:25 PM
@AndrasDeak now I'm home I can look at it better and you're right. Only the last result of an expression is available in iPython locals()
 
@roganjosh I don't see any surprising behaviour in ipython.
hah, exact same time
 
:P
 
I'm glad we agree
 
a=np.exp(1j*np.pi); a=[1,2,3] was cunning, because it turned me full-circle back to what I already had for a in locals. <hat tip>
When it nears home time and I can escape the office I guess I get sloppy at seeing such details
 
I actually meant for those to be on two separate input lines :P
 
6:31 PM
The result would be the same for my test. When you said to make it more complex, I thought you wanted me to add that on to what I already had executed in a fresh session... the last thing I executed being a = [1, 2, 3]
So there was some degree of astonishment that I could still see a = 6 but only the history of a=np.exp(1j*np.pi)
 
hehe
 
Shame on me for commenting some false hope to the OP that it might be able to salvage their data. They're already on a rollercoaster
 
I only meant that so that you don't get confused between the history string and the actual value
I clearly failed ;)
 
You're dissolving the evil mastermind image I just built and paid respect to :P
 
A little while ago I stumbled across one of my early Python experiments. Here's the new improved version:
digits = (
    ' _     _  _     _  _  _  _  _ ',
    '| |  | _| _||_||_ |_   ||_||_|',
    '|_|  ||_  _|  | _||_|  ||_| _|',
)
segments = [[row[3*i:3*i+3] for row in digits] for i in range(10)]

def convert(num):
    buf = [[], [], []]
    for c in str(num):
        for row, seg in zip(buf, segments[int(c)]):
            row.append(seg)
    return '\n'.join([' '.join(row) for row in buf])

print(convert(9876543210))
# output
 _   _   _   _   _       _   _       _
|_| |_|   | |_  |_  |_|  _|  _|   | | |
7
 
wim
6:36 PM
80085
 
:) It looks a little better in my terminal. But I guess it might look better in your browsers than in mine, depending on your fonts.
 
wim
looks great in sublimetext
-1 for converting num to str just to convert back to num again :P
 
That's way too awesome for a banal wednesday
 
@wim It's the fastest way to get digits of a number in Python. And the passed in num might be a string, in which case str(num) just returns the original string object.
 
wim
for 5 quatloos: print the numbers one by one, rather than buffering them all up and joining
 
6:44 PM
Sounds painful. I assume you want it done using terminal cursor movement commands?
 
\033[E and \033[F sound useful
 
digits = (
    ' _     _  _     _  _  _  _  _ ',
    '| |  | _| _||_||_ |_   ||_||_|',
    '|_|  ||_  _|  | _||_|  ||_| _|',
)
segments = [[row[3*i:3*i+3] for row in digits] for i in range(10)]

def convert(num):
    buf = [[], [], []]
    for c in str(num):
        for row, seg in zip(buf, segments[int(c)]):
            row.append(seg)

    for i in zip(*buf):
        yield '\n'.join(i)

for each in convert(9876543210):
    print(each)
prints out 9 8 7 6 5 4 3 2 1 0 all in new lines :D or did i misunderstand the requirements
 
I believe we have a winner?
 
6:59 PM
I believe wim meant one at a time left to right
 
oh.... u mean like pause ?
that does sound painful... hmmm it would also depend on your console
5 quatloos is too cheap for that, I'm going to pass on this contract :D
 
wim
@PM2Ring yes.
@MooingRawr OK, I'll make it 15,000 quatloos.
 
That kind of fluctuation.. are quatloos now a cryptocurrency?
 
this just in, a rogue pythonista completely breaks internet economy with liberal money printing
 
7:16 PM
hmm tempting. just to lay some ground rules do you care how it's created or is presentation/output all you care ?
 
DSM
7:26 PM
I'm giving a talk tomorrow on recent developments in Python. I'll be talking about the type hinting changes, contextvars and dataclasses (so 'what's new in 3.7') as well as 572 and Guido's retirement. Anything else of interest I should make sure to include?
 
sounds like good coverage
Is this going to be available publicly?
 
who is the audience? programmers? management? data science guys?
 
DSM
1) No, it's just in-house, esp. given that I'm winging it; and 2) Python devs who mostly do data work here at NumberFirm and across our ParentGroup (can't remember what fake name I use for our corporate parent..)
 
Any updates on Pandas 2 or feather or other bigger data related thingies
 
DSM
Hmm. That's actually a good idea for a follow-up talk.
 
7:33 PM
Gosh, I'd forgotten about Pandas 2. It looks dead in the water?
 
DSM
I talked to Jeff @ PyCon about pd2 and he said it's still being worked on, but it hit some time availability potholes.
 
Presumably because they're pruning the API of 1 quite a bit?
 
wim
I would hold off on the 572 and Guido's "retirement". The whole thing might just blow over.
 
DSM
Hopefully, because a lot of cruft has accumulated. But I got the impression it was more backend-y, structural stuff they were batting around, rather than API-level stuff.
 
wim
instead, module __dir__ and __getattr__ might be more interesting.
 
7:40 PM
def printshifted(strs, c):
    for s in strs:
        print(f'\033[{c}C'*(c>0) + s + '\033[E', end='', flush=True)

for i in range(15):
    printshifted([*'|||'], i)
    print('\033[F'*3, end='', flush=True)
    time.sleep(0.5)
I offer this to anyone still trying to print those numbers one at a time.
 
wim
nice
I wonder if "docker pull" does the same stuff for its progress bars, or it just uses curses.
 
I kinda have a mental model of pd1 that I'm able to work in and learn more about. I'm glad the effort isn't being directed into streamlining that. pd2 really will take some thinking because I'm not sure they anticipated the popularity.
 
wim would it be cheating if i group what i need and print that out and just flush the stdout :D ?
u never did answer if all u care is what u see on screen. :P
 
Cabbage
 
Well, popularity and the diversity of problems that come with it*
cbg
 
7:46 PM
How does this strike you all as a title: "Perform a 'join' on two bumpy arrays"
 
@Simon you on a phone?
 
Well it's clearly impossible. bumpy force is incredibly strong and can't be overcome by a simple join
 
DSM
Oddly enough I see "bumpy" a lot, but never "vumpy".
Well, maybe it's not so odd, bumpy being a word and all.
 
No, I just saw an unfortunate OP that just posted that @piRSquared
 
ahh, that strikes me as an iPhone autocorrection
Also, the answer would come from the use of this from numpy.core.defchararray import add
 
7:50 PM
You can't have read the question. :(
 
I didn't... just guessing
 
wim
@MooingRawr yes, cheating and lame
 
Here it is: stackoverflow.com/questions/51409861/… (maybe vote to close as unclear, not sure, so I won't tag it as such)
 
please excuse my stupidity but... why doesn't this work? P = pandas.Series([0,1,0,5,0,0,0,10,0,1]) pandas.ewma(P)
I get AttributeError: module 'pandas' has no attribute 'ewma'
 
DSM
Those are the docs for 0.17.0. Are you using 0.17.0?
 
7:52 PM
@wim k im not going down the rabbit hole of curses/cursors
 
Okay, turns out there wasn't that much more work, I'm claiming my quatloos.
import time
digits = (
    ' _     _  _     _  _  _  _  _ ',
    '| |  | _| _||_||_ |_   ||_||_|',
    '|_|  ||_  _|  | _||_|  ||_| _|',
)
segments = [[row[3*i:3*i+3] for row in digits] for i in range(10)]

def convert(num):
    buf = [[], [], []]
    for row, seg in zip(buf, segments[num]):
        row.append(seg)
    return [' '.join(row) for row in buf]

def printshifted(strs, c):
    for s in strs:
        print(f'\033[{c}C'*(c>0) + s + '\033[E', end='', flush=True)

def printbignumber(n):
    for i, d in enumerate(str(n)):
 
@Simon mcve
import numpy as np
from numpy.core.defchararray import add

a = np.array(list('abcd'))
b = np.array(list('wxyz'))

add(a, b)

array(['aw', 'bx', 'cy', 'dz'], dtype='<U2')
 
might want to specify OS/terminal
 | | _  _||_  _  _| _| |_| | _ |_  _| _ |_ |_| _  | | _ |_||_| _ |_| _| _ | ||_|
 
but I am completely confused
what am I doing wrong?
 
@piRSquared Should be closed? It seems totally unclear, then again I'm not a numpy expert so I'm assuming a catch...
 
7:54 PM
link?
 
DSM
@Anush: it sounds like you're reading the documentation from a very old version of pandas and using a different version.
 
In 0.20.3 I get ValueError: Must pass one of com, span, halflife, or alpha. What version are you using?
 
wim
@MoxieBall works great
 
I am using 0.23.1
how do you do it now?
 
@MooingRawr heh, well then. bash 4.4.19 on OS X terminal
 
7:54 PM
I mean with a modern pandas
 
3 mins ago, by Simon
Here it is: https://stackoverflow.com/questions/51409861/perform-a-join-on-two-numpy-arrays (maybe vote to close as unclear, not sure, so I won't tag it as such)
 
@MoxieBall k so i wont get to see it :( but I have faith in you :D
 
@Anush Look at this.
 
@wim only if you have lines under the line in the terminal where you run it, but other than that...
 
@IMCoins Oh ok.. this is confusing.
 
wim
7:56 PM
just let me know your account number, routing number, and internet banking password and i'll transfer you your quatloos in 5 business days
 
I find python3.7's breakpoint built-in oddly convenient
I'd be willing to let it go with 572, though
 
@MooingRawr what terminal are you using?
 
DSM
@AndrasDeak: me too! I'm not opposed to every change. ;-)
 
@Anush What's confusing ? :)
 
pd.Series([0,1,0,5,0,0,0,10,0,1]).ewm(alpha=0.95).mean()
turns out you needs the mean at the end for some reason
to get what I what I would call the exponentially weighted moving average
@IMCoins ^^
 
DSM
7:59 PM
It wouldn't make any sense to take the mean beforehand, though, because then you've only got one number left.
If you read the documentation, you'll see how expanding/rolling/ewm etc. now work.
 
02:00 - 20:0020:00 - 00:00

« first day (2832 days earlier)      last day (2113 days later) »