« first day (3131 days earlier)      last day (1817 days later) » 

2:40 AM
cbg
 
cbg
 
3:18 AM
is there a version of .index() for numpy matrices?
 
3:29 AM
@heather try np.where
>>> import numpy as np
>>> a = np.array([1, 2, 3, 4, 5])
>>> np.where(a==4)
(array([3], dtype=int64),)
>>>
To only get the integer:
>>> np.where(a==4)[0][0]
3
>>>
 
perfect, thank you
 
@heather Your welcome :-)
 
wait...does it work on a matrix as well, not just an array? because i'm getting an error
actually, nvm, i screwed up how I was writing it, sorry =P
 
Lol, happy it works
 
 
3 hours later…
@AndrasDeak That guy really is a beginner, he doesn't know what matplotlib is...
 
so?
 
I closed it for you
I voted to.
 
6:47 AM
@AndrasDeak oops! I realised I fell asleep with laptop screen open and must have had the chat window open when I tried to close it but my contact lenses case was on the keyboard :/
 
rofl
that's pretty amusing. Oddly enough, been there, done that
in any case, good morning :P
 
6:59 AM
Morning :) I'm quite astonished at the range of characters my half-asleep fumbling managed to make and send! It's no wonder that my screen is obliterated; I have to run it through the TV but the laptop is nearly 7 years old and keeps plodding
 
Anyone with expertise in Selenium?
 
as always, you'll have a better chance of getting a response by just asking your question. go ahead :)
 
6
Q: Sending emojis with selenium's send_keys()

abuI would like to send a :heart: emoji with selenium's send_keys() from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait driver = webdriver.Chrome('./chromedriver') driver.get("https://web.whatsapp.com/") wait = WebDriverWait(driver, 600) message = driver.find_e...

there are 2 approach to solve this problem :
1) copy & paste mechnism
2) use JS to inject the piece of text into textbox
my problem is both copy & paste mech. needs me to use external library such as pyperclip, and setting it up and using it on raspbian is quite a pain. So i am looking for an alternative.
Does this explain my problem or do i sound completely crazy?
 
what are you trying to accomplish and if copy/paste is unacceptable, why aren't you using #2?
 
well that is the plan, but I want to check if I have missed anything out.
usually I go with the workarounds and then realize there was a one-liner for it, like it could have been done just by changing a few flags or likewise
 
7:12 AM
we are still missing context here, which task are you actually trying to complete? send every possible emoji? send your three favorite ones? send twelve random emojis?
 
I just realized that pyperclip is written with an Aussie accent
 
and i shall officially never look at pyperclip the same way ever again..
 
😎 😍 😘 🥰 🤩 😻
copied from getemoji.com
 
we know what emojis are, do you want to send exactly those six?
 
@tripleee i want to be able to send//use any of the images
 
7:19 AM
you are really going out of your way to avoid answering, aren't you?
 
let me give the exact thing i am trying to do.
1. open instagram post
2. send a comment
3. click enter
i meant smileys are the current roadblock.
 
any random emoji from the faces group?
 
where does raspbian fit into the picture? if it doesn't have to, the link you posted should be just fine no?
 
yes sir.
I actually don't have full understanding of the problem. but somehow I have to start the terminal in raspberry pi using VNC and then launch my code inorder to use the pyperclip module cuz it somehow depends on GUI or something. if i directly ssh into the pi and execute my code it throws pyperclip err
 
unicode.org/reports/tr51 doesn't seem to provide a simple way to enumerate all emoji but randomly selecting code points from en.wikipedia.org/wiki/Emoticons_(Unicode_block) gives you a repertoire of 80
and if I understand your requirements correctly, that should obviate the need for any copy/paste
if the Javascript code requires those as surrogate pairs, you need stackoverflow.com/questions/40222971/…
actually I was typing too fast, you can very well extract all Unicode emoji by the isEmoji property, what I meant to say is you can't easily isolate the ones which are actually faces (emoticons)
@Aqua4 can you provide the exact traceback?
 
7:43 AM
by traceback you mean the code or string i am trying to enter
text = u'Python is 👍'
so could i insert this string without iterating through all the words and converting IF emoji to unicode
 
@Aqua4 when you get an error, Python prints "traceback" and several lines of diagnostics -- we want to see those
 
traceback refers to the error messages (if any.) he might be refering to pyperclip
 
@ParitoshSingh in fact s/h/it is responding to a message which ends with "it throws pyperclip error"
 
yes, i noticed that after the fact and hoped i wouldn't be caught on it :P
Also, generic "he". I suppose its not as commonly accepted anymore?
 
@Aqua4 not sure what you mean by "IF" ... the code might not work if Javascript has trouble with the bare code point but that's outside the scope of my knowledge
@ParitoshSingh you guessed correctly this time but you want to be careful
 
7:52 AM
aye, noted. I sometimes use the plural instead when im actively thinking about it, but its a tough habit to break when autopilot
 
@Aqua4 if text = u'Python is 👍' doesn't work, try text = u'Python is \uD83D\uDC4D'
 
@tripleee this is the error https://github.com/SeleniumHQ/selenium/issues/3257
I will upload the exact traceback after a couple of hours
 
the surrogate pair is invalid in bare Unicode but Python will store it just fine
 
@ParitoshSingh isn't the generic singular pronoun in english 'they'?
 
oh if you get "chromedriver only supports characters in the BMP" then you can't use these emoji because ChromeDriver
 
7:58 AM
@Arne depends on the education i suppose. Everyone uses "he" here.
But proper english teaches "they" iirc
 
@tripleee the end user will send a string like this 'Python is 👍'
i will have to convert it at my end
 
Or well, "proper" would also be subjective.
 
@Aqua4 who is an "end user" here? you still haven't described what you are doing
@Aqua4 if the driver accepts surrogate pairs then see the link above for how to convert
27 mins ago, by tripleee
if the Javascript code requires those as surrogate pairs, you need https://stackoverflow.com/questions/40222971/python-find-equivalent-surrogate-pair-from-non-bmp-unicode-char
 
so i have a .xlsx file containing list of comment
1. read using pandas
2. select random comment
3. enter it to comment box (facing the issue here)
if the string contains a special char or even few chars from other languages based on the git issue, I've sent my code will crash
 
Do you all know about PyBay conference (SF, Aug 17-18)? The CFP deadline just passed.
 
8:06 AM
@ParitoshSingh Either way good to know, I wasn't aware
 
@davidism That answer's been deleted, but at least 1 person disagrees, since it's now got an undelete vote.
 
@Arne wikipedia link (yes, i know, i know. wikipedia?! actually mentions some citations for its use in formal english, though its definitely a trickier subject lately, as shown with this "It has also been seen as prejudicial by some,[25] as in the following cases"
 
@Aqua4 then if the Selenium driver can work with surrogate pairs, convert the text to surrogate pairs if it contains code points above 0xFFFF
still not sure what the role of pyperclip would be here
 
@ParitoshSingh Modern English tends to use singular "they", but old-fashioned prescriptive grammar texts say that "he" should be used as the generic singular, and that singular "they" is ungrammatical. But singular "they" has a proud history going back to before the time of Shakespeare.
 
Martijn's answer seems like the perfect solution to what you appear to be asking now (but if history is any indication, I guess we can expect you to reveal new intriguing requirements)
 
8:17 AM
@tripleee using pyperclip i can directly copy the whole string along with the emoji
2. then using paste, it directly copies the exact string along with the emoji to the text box.
 
the terminology you seem to be missing is that the Unicode Basic Multilingual Plane (BMP) covers the code points which can be expressed in 16 bits
 
(goes back to catching up on the transcript)
 
@Aqua4 this sounds like a horrible detour if you are already reading the Excel into memory using Pandas
 
@tripleee I am absolutely clueless about what you are talking about
hence i am trying to find some alternative
 
Unicode contains several million characters but the "simple" ones are in the BMP ... but the emoji you are trying to use are not, and so the Chrome driver refuses to handle them
 
8:19 AM
@tripleee clueless about this
 
@cs95 Ah I finally figured you meant "assuming U9-Forward is of drinking age", not "assuming my friend", who I know well to be of drinking age...
Hey also why your name change?
 
converting them to two 16-bit code points (a surrogate pair) could perhaps work around this problem if I understand the github issue you liked to correctly
so '👍' aka'\U0001F44D' is equivalent to the surrogate pair ['\ud83d', '\udc4d'] (notice how the lowercase \u only accommodates four hex characters, i.e. 16 bits, whereas \U handles and requires a full 8-character hex string, i.e. 32 bits)
 
thanks for explaining it in simple terms
 
Python doesn't particularly like surrogate pairs but it looks like your JavaScript code requires non-BMP code points to be represented as surrogates
*"linked to" of course, sorry for sloppy typing
 
i now have a rough idea of what needs to be done
https://stackoverflow.com/questions/31986614/what-is-a-surrogate-pair
 
8:26 AM
excellent, good luck with that then (-:
 
til surrogate pairs
 
8:38 AM
Hi,

I got R shiny app code which does some computation but I think it's slow. Any suggestion any other stack that I can use to make it better?
mainly I am looking for language which has capabilities to work with data frames
I thought of python using django framework
any suggestions?
 
side note: usually the languages, while relatively fast/slow, are all "fast enough". If the code is slow, your first step should be to question the code itself.
Have you tried profiling your code? Is the code itself written properly or not?
 
@ParitoshSingh in addition I am looking for more functions like CRUD operations
and making it asynchronous
in R shiny I have to use future, promise functions
 
ah. Well, python can be used for just about anything. I cannot guess if your usecase will have a better tool or not though, but python has a pretty strong library support system going for it
 
but will I be able to use libraries like pandas, scikit etc along with framework like dhango or flask
 
python has an async module. regardless, i'd recommend perhaps searching if all your tasks can be done in python or not before commiting to the switch. If you're satisfied, then sure, make the switch.
 
8:43 AM
*django
 
I don't know Shiny but it looks like it abstracts away quite a bit of the front-end work, which you'll need to handle if you go with a web framework. You'll also probably want a JS plotting library to handle the interactive parts
It might also be worth looking at Jupyter as well
 
but jupyter is just a notebook right?
basically I looking to make sort of like CRM app with dashboards
 
I don't really use it so I don't know the limits of what it can do in relation to what you need
In that case, your options are probably Flask/Django and some front-end template (you can get free HTML templates to make the front-end easier to put together), or you could go with something like ERPNext. If you want to go with a web framework and you're not familiar with Python, Flask will be easier than Django to get started
 
9:01 AM
cbg
Is it Fig 3.3 or Fig. 3.3?
 
Typically Fig. 3.3
 
9:13 AM
@Hakaishin American & British usages differ. quickanddirtytips.com/education/grammar/…
 
Morning guys, wondering if there's a way of drag & drop on Mac ? Instead of specifying the path or having the python file inside every folder ? Applescript or Automator is the only way ?
 
Well that's awfully unclear. Drag what from where to where?
 
from a folder into a droplet or so
Sorry for a confusing question
For example I have now : images = ['1.png', '2.png', '3.png']
Would help to not specify the filenames and stuff...just drag the files and run the script
 
So your program has a GUI and you want to take files from your desktop, or from your file manager, and drop them into your program's GUI?
Or you don't have a GUI and you want to drop a bunch of files onto your_program.exe to fire up your app with those files as arguments?
 
@Aran-Fey emmmm...second version but not .exe i'm working on Mac
 
9:25 AM
Well, that's easy to code - as far as code is concerned, you just need to grab the file paths from sys.argv
 
@Aran-Fey I was reading a lot about this sys.argv didn't really get it :( it should be included in my python file ?
 
I don't know if Mac lets you drag and drop files onto programs out of the box, though. You may have to do some configuration there. On Windows it requires a registry setting, I think
import sys
images = sys.argv[1:]
^ that's it
 
@Aran-Fey Mac won't let me do it out of the box :( ohhh wooow ?! so easy ?! let me give it a try
hmmm....no luck :( the files need to be inside a folder in order to work ? or ?
 
What happened? Did it crash? Did it set images to an empty list? Did it open the images with MS Paint? Something else?
 
IndexError: list index out of range
I have the files on Desktop
also, do I have to run the .py from terminal ?
now I'm doing it through SublimeText
 
9:38 AM
...I thought you wanted to run the program by dropping files on it?
 
no luck with that...nothing happens :(
won't let me drag & drop
 
Then I assume the IndexError was caused by you trying to access sys.argv (or images) without having passed any command line arguments?
 
@PM2Ring So it should be Fig. both in American and British English right? because g is not the ending of Figure
 
Index error I get it only when run with SublimeText
 
So without command line arguments, then
 
9:40 AM
@Hakaishin Correct.
 
@Aran-Fey yes :( now did it with and i get : FileNotFoundError: [Errno 2] No such file or directory: '%*'
weird :(
I'll try some applescript or automator :( maybe will be easier to figure out
 
https://stackoverflow.com/questions/12201928/python-open-gives-ioerror-errno-2-no-such-file-or-directory

@Andie31
 
@Andie31 I have no clue what's causing that IndexError or FileNotFoundError. I have no clue what your program does that could cause an IndexError. Literally the only thing I know is how you're running the code. That's not nearly enough information to help you out. 95% of helping you has been asking questions so far. You need to give more information when you have a problem. Having to pull every tiny scrap of information out of you is annoying and not productive.
 
@Aran-Fey ohhhh man I'm really sorry that I'm that annoying :( Thing is...I'm doing my research before asking here. I try this and that...and if I can't figure out I come here to ask you guys...because there's nobody else I can ask...sorry again...
 
Just a piece of constructive criticism
 
9:52 AM
@Aran-Fey fully accepted !
 
I've been binge-watching Kitchen Nightmares - and thanks to those hours of Gordon Ramsay yelling and swearing at people, I may have a shorter fuse than usual today
 
@noob "mainly I am looking for language which has capabilities to work with data frames": Python/pandas, or Spark/Scala. It helps if you tell us more what your dataframes are: text, financial, social-media... and what your use-case is
 
@Aran-Fey hehe :))) gotta check that Show :)
 
dataframes contains data from point of sale machines so it has customer data and financial data basically how much was the sale and based on sale the company provides loan
 
And as for the "R shiny app code which does some computation but I think it's slow", did you mean you want fast multithreaded computation (again, on what type of data? consider migrating to Spark), or that also the visualization side of the app is slow (in which case, Python or one of the recent JS frameworks).
 
10:00 AM
since it's harder to fake sales data on POS machine it's good indicator of whether loan will be repayed or not
using daily data it would be easier to monitor the health of a cusotmer loan
if they are defaulting on daily EMIs we can classify then based on how many days it has been and calculating various metrics
 
@noob Ok, just use Python/pandas already :) I don't think you'll need multithreading. But if you really do, go to Spark already.
 
@Andie31 Sorry, I don't know Mac, but this looks like it might have some useful info, either on the page itself, or in one of the links. stackoverflow.com/questions/30003271/… I suspect you may need to create an AppleScript droplet as a wrapper for the Python script.
 
@noob sure, I'd call that "ML classification monitoring health of a customer loan by monitoring (aggregated) daily sales(/spending) data"
 
but then after classifying them we need to call customers who have deafulted for long so we need to somehow do CRUD operation in order to remember whom we have sent call already and when
 
recbg
 
10:06 AM
@noob Ok, you could use Python/pandas on MySQL/Postgres (which database do financial people use? you need consistency)
 
they don't use any db now but we get the data in excel sheet from a POS vendor
there is consistency
that's not an issue. Maybe we can talk to vendor maybe they'll provide some api
thing is I am just an intern here and my internship will finish soon
 
@noob "consistency" in the database sense, i.e. it doesn't screw up your DB even if it your app loses connection, or DB has to rollback or crashes. I recommend Postgres, but some people say you can manage with MySQL
 
but maybe I can do something for my resume it would be good. Now they are just using standalone R shiny app
 
Then again I suppose you're only reading their data, not writing, so MySQL will probably fit the bill. Postgres is good for higher performance (multiple sessions and much higher throughput, almost never falls over)
 
@PM2Ring - Thank you ! I think I'll go with Applescript option...looks doable. Thank you
 
10:09 AM
okay I will look at all these options thanks @smci
 
@noob Yeah I also program R and I know several people who develop for R/shiny, but the word on the street is its performance is limited and once you lock into that ecosphere, you don't have any serious options you can upgrade to.
@noob Sure. But in the long term, if you want multithreaded performance, use PySpark, not pandas.
@noob "we need to somehow do CRUD operation in order to remember whom we have sent call already and when" I'm sure there are APIs for that, I just haven't done it myself.
 
By the way this can't be an ML project right because I am just using data to classify based on days defaulted and calculating probability of repayment based on past and current sales
in ML classifier it has to classify a customer without know much data about sales
but maybe based on geography, amount of loan, and other features
It's just stats and analytics no ML
 
@AndrasDeak You get some "interesting" drivers on Hungarian roads... forums.xkcd.com/viewtopic.php?p=4453524#p4453524
 
Indeed.
at least it's not a common sight and as far as I know none of those were Hungarians :P
but that probably has more to do with such shenanigans being "necessary" for international transport, rather than due to the wise judgement of my people
 
10:39 AM
I expect Hungarians to gave good instincts related to horses, but I guess that doesn't necessarily translate to motor vehicles.
 
ha, that was quite a while back :P
 
:)
 
we haven't been nomads for, uh, 1100 years
I've never sat on a horse, but I suspect my mild acrophobia would kick in :D
 
@AndrasDeak Sure, but I figured that sort of thing tends to stay in the national psyche for a long time.
 
well for what it's worth I don't feel being culturally ingrained to be a horseman
 
10:52 AM
laurel
 
I suspect most of my people would agree that horses are just horses rather than being some kind of remrant of our nomadic heritage
 
@AndrasDeak Ok.
 
there's some top-down attempt to idolize horse riding in a way, these days, but that seems more related to the hussars than the older days
(of course there are always those who "preserve traditions" and want to live in tents made of felt and shoot arrows from horseback, but these people tend to have a very specific view of other people and historical borders)
 
11:06 AM
In reality, since the start of European colonization of Australia, it's always been a very urbanized country, with well over 90% of the population living in the cities, and mostly the capital cities. But we like to think of characters like Crocodile Dundee and Steve Irwin as being archetypal Aussies. :)
In Australia, we have a relatively short history, and a century or so ago a national mythos was deliberately constructed by some of our early poets, like A. B. Patterson, who wrote The Man from Snowy River. So we have this image that an Aussie bloke is supposed to be good with horses, and feel at home in the bush, close to nature.
 
wow, a library page where you can't copy-paste
> And Clancy of the Overflow came down to lend a hand,
almost relevant to SO ;)
 
Laurel
Here's a classic short story from another of the creators of the Aussie mythos. [The Loaded Dog](https://www.alldownunder.com/australian-authors/henry-lawson/loaded-dog.htm),
by Henry Lawson.
 
newline breaks markdown
 
11:22 AM
I'm pissed off.. they're teaching us C instead of python in uni :'(
 
@AndrasDeak Yes. I didn't notice that I still had a newline in there. Serves me right for trying to copy & paste the author & title.
@Xosrov C is a good language, especially if you want to teach people low-level stuff. But it's not a good choice as a first language to learn.
Python's probably pretty good as a first language, but it may not be so good if you do want to learn the low-level stuff.
Before OOP, I thought Pascal was a good 1st language. But I guess it's a bit archaic these days, and its OOP descendant, Ada, isn't too popular outside of specialized circles.
 
I'm about to write a C program... currently downloading 6GB IDE + compiler + runtime + whatnot. Wish me luck.
 
good luck, you got this
 
@Aran-Fey windows problems!
fingers crossed anyway :P
 
until the linux kernel comes along on windows atleast :P
 
11:31 AM
can't wait until MS-gcc is the standard compiler everywhere
 
(actually, i dont even know if that would come with gcc compiler or not)
 
I'm gonna be interacting with the clipboard, the window manager, and simulating keystrokes... it's gonna be a blast, I'm sure
 
do it in python instead :P
(i know, i know, probably some very specific requirement, something along the lines of: "you must undergo self torture to get this task done, C only, there is no choice.")
 
yeah, basically python is probably going to be annoyingly slow
 
@Aran-Fey ugh
all that in C...then C is the least of your problems
 
11:34 AM
it's a super short-running program, so it's gonna be noticeable if the python program needs half a second to start up
FWIW, I've already done all of these things in python with ctypes
 
ah. performance matters that much?
yikes
i suppose that should make it easier to translate the code over though? not too familiar with ctypes
 
yeah, it's pretty similar to C as far as I can tell
just knowing the names of the functions I need to call is already super useful :D
 
if startup overhead is your concern, maybe you can start it just once and run it as a service or something?
 
I thought of that, then I realized that Aran must've thought of that too
 
The thing is, the program will be registered as a protocol handler and it'll be launched by clicking a link in the browser
Well, we'll see how it goes... if it doesn't work out I can still implement the whole thing in python and see if it's good enough
If these PCs had python installed it probably wouldn't be a problem... but since I have to package everything (the program itself + the python runtime) into a 30+MB executable, I do fear it'd take an annoyingly long time to start up
 
11:44 AM
if you have the code ready to test, perhaps explore that route further before subjecting yourself to this?
might help to have some kind of dummy run just to get a better idea
(though again, if you feel like doing it in C, then by all means go for it)
 
@AndrasDeak I know you're being sarcastic, but I really wish you hadn't said that... ;)
 
I've always wanted to get into game development, that's why I want to learn C, but it's also different from what I'm used to, so a steep learning curve..
 
If you want to learn C why are you sad that you have to learn C? :P
 
Is anyone familiar with unit testing a flask app that makes use of the factory pattern and blueprints? The tutorial just makes a single tests.py file in the top level directory but that will be awful for a full-blown app, so I would prefer a "tests" directory where I can break it down by blueprint. Problem is, I don't seem to be able to import my application
 
performance matters in games. C is a good choice there
 
11:45 AM
I wish there were game engines as good as unity/unreal in python
 
My ineptitude with the import system is probably not helping
 
@ParitoshSingh Yeah, to be honest, I'm kind of looking forward to the challenge. It's been ages since I've done anything with C/C++
 
Well i want and i don't want i guess
 
@Aran-Fey ah nice! well, once again, good luck haha
dont leave any UB* hanging in your code by mistake! ;)
yep, derp!
 
@ParitoshSingh Now you're asking for the impossible... :P
 
11:52 AM
@roganjosh can you write your app as a package?
 
@Arne I probably could, I would have to play around with doing that a bit. I had hoped there may be an import trick without going down that route but it may be the only way
 
there is, you can just add to the path
example of having a test directory that is split off from the source code
 
12:08 PM
That looks most promising, thanks
 
add to the path -> append your source code directory to the pythonpath before executing tests
 
12:55 PM
A recent question asks, "I don't like order-preserved dicts. How do I rearrange my dicts so they look like pre-3.6 dicts?". My mind boggles at the XYness.
 
they probably relied on a huge dict's order to seed their random stream that is the foundation of their password factory
 
Maybe the real question is "my program emits json and our test suite verifies that the answer is correct by doing a simple byte-for-byte comparison. It was originally written in 3.5, and now that we've upgraded, the tests are failing because the keys aren't in the same order. What should I do?"
 
possible but less likely
 
Especially since a good portion of built-in types get hashed with a salt that changes every time the program runs
So they'd have to be jsonifying custom types that don't use a salt
 
My guess would be "I explained hashmaps to someone and said that they are very different from lists. When I showed python dicts as an example I looked like a fool. Make Dicts Unordered Again."
 
1:03 PM
that last part would look great on a red baseball cap
 
All of the answers so far are boring explanations about how 3.6 has order-preservation blah blah blah... I have half a mind to make a bounty for an answer that tells you exactly how to emulate Cpython 3.5 dict ordering in 3.6+
 
:(
I'd hate for something like that to become HNQ
 
Hmm, MisterMiyagi's edit adds pretty much what I wanted.
I imagined something more in the style of "one hundred lines of C ripped from the CPython 3.5 repository" but I guess calling sorted and hash works too...
 
1:23 PM
I ended up writing a C++ program, and now I dread to find out if my little 100-line code won't work because it requires that annoying C++ redistributable thingy to be installed
 
the what now?
I thought C++ "just works" as much as C does
 
> The Visual C++ Redistributable Packages install run-time components that are required to run C++ applications built using Visual Studio 2015.
 
Ah, visual studio thing. So that's "windows problems"^2 :P
 
welp, no point worrying about it. I'll find out tomorrow anyhow
 
I suspect those components are only necessary if you invoked any special bells and whistles, e.g. GUI code that doesn't directly spawn windows via win32 api calls.
But if the components are helpfully included even when they don't need to be, you can always purge Visual Studio from your computer and use MinGW's compiler collection instead
 
1:30 PM
2 hours ago, by Aran-Fey
I'm gonna be interacting with the clipboard, the window manager, and simulating keystrokes... it's gonna be a blast, I'm sure
 
I like it how the MS download center has a huge MS laptop advert on top
 
I certify that MinGW produces exe files that do not require any external dependencies against your will
 
@Aran-Fey just prompt your users to download it when they install your script; they won't even notice ;)
 
@Kevin Good to know, I'll give that a shot if necessary
 
1:33 PM
You can do keystroke and clipboard stuff with just the windows API, although I never could get my clipboard code to actually work because I could not determine which of the 17 mutually exclusive proprietary data formats I was supposed to use
 
nice
one for each letter
 
anyone know why __await__ just has to be an iterator, not a generator?
 
good thing it's not encoded with Hungarian (we have 40 or 44 if you include q, w, x, y)
 
I've tried some toy examples with various pure iterators, and stuff went to hell pretty quickly...
 
m8_
Is there a way to do something like the following: df.loc[~(df["col_name"].str.lower()).isin(my_list), "col_name"] = "Other"
I want to check values against a list using loc but str.lower() does not work in this way
 
1:38 PM
Perhaps there's no good reason to return an iterator instead of a generator, but the language devs decided not to demand an interface more complicated than what is actually required
Just in case somebody does think of a use case where an iterator would be actually good
 
well, it means you cannot send to the awaitable, which seems to defeat the purpose of await :/
 
Perhaps you could communicate with the awaitable some other way, perhaps by mutating a message queue. (still not endorsing this as a good design)
 
1:54 PM
Hello! Is there any way to show an int (5) as float (5.00)?
                priceInRowI = round(float(rowI[6].value or 0.00), 2)
I am doing the above line, but it stays 0 and 5, not 0.00 and 5.00
 
Last night I finally understood why Quico's avatar is broken for me meta.stackoverflow.com/questions/384864/…
 
>>> x = 5
>>> "{:.2f}".format(x)
'5.00'
 
@QuicoLlinaresLlorens do you want it to be a float or display it as a float?
 
to be float
 
Oh, ignore my post then
 
1:57 PM
no.
i think you're mixing data and representation
 
I wonder what "it stays 5" really means
 
round(..., 2) should already give you a float
 
"5.00" is a string representation of the int 5 or the float 5.0 The keyword being string. Kevin shows how to create the right representation. You can use it when displaying, and store the actual number as 5 if int, or 5.0 as float.
 
Apropos of nothing, this is everyone's weekly reminder to not use floats for storing monetary data.
 
@QuicoLlinaresLlorens what are you doing with priceInRowI afterward that makes you say "it stays 5"?
this could even be a failed mutation thing
 
2:00 PM
I am inserting it in my mongodb database
 
Are you inserting it into a float column? If not, is that a problem?
 
maybe the problem is with mongo, that it turns a float like X.00 to a X
it is a double, yes
 
I'm curious, what happens if instead of integer-valued floats you have something like 2.5? Does it get truncated or does it "stay 2.5"? This might help clarify whether there's a representation issue or a printing issue.
otherwise you'll probably have to be a bit more specific with your use case, giving others an MCVE (I don't know databases so I won't be able to help)
 
And how can you tell whether the value stays or not? The exact line of code that you use to check?
 
2:06 PM
I'm definitely interested in seeing an MCVE. I gave my best two cents already, which is the best I can do without some code to run.
 
according to the all-knowing internet, some MongoDB shells treat all numbers the same for display purposes
 
m8_
Hey, can you use .loc with str.lower(), like df.loc[df["col_name"].str.lower().isin(my_list)]?
 
Is that not something that you can just try? And why would it not work?
 
m8_
I did try, it didn't work. Which is why I'm asking because maybe I'm doing it wrong
 
hello all
 
2:18 PM
well if it didn't work...
hello
 
m8_
again, maybe I'm doing it wrong, which is why I gave the example I tried
 
you may be able to apply the str.lower method
 
m8_
gotcha, thanks. I'll try that
 
You probably threw the result away
df = pd.DataFrame({'a': ['HELlo', 'ByE']})
df = df.loc[df['a'].str.lower().isin(['hello'])]
print(df.head())
 
m8_
ah, I'll try that too
thanks all
@roganjosh, can you explain when I would need to assign a .loc vs not? I'm not clear why sometimes it works without assigning the result to the df
 
2:24 PM
Fermat's Kevin's Principle: the answer given to an ambiguous question is the one that takes the least amount of time to compose.
"Why don't you try it and find out?" is often the shortest answer.
 
@m8_ You're probably seeing it being used for assignment mentioned in the bottom half of this answer
df = pd.DataFrame({'a': ['HELlo', 'ByE'], 'b': ['', '']})
df.loc[df['a'].str.lower().isin(['hello']), 'b'] = 'Gotcha'
print(df.head())
 
Question askers can game this principle by wording their question such that "why don't you try it and find out?" can't possibly be a coherent answer. Usually this entails describing in the first message what you tried and how the output wasn't what you wanted
 
m8_
@roganjosh, ah thanks. That makes sense
 
@Kevin but it didn't work
 
m8_
2:30 PM
@Kevin, great rant. because str.lower() didn't work is pretty complex, I suspect
I'll get my crayons next time
 
you missed their point.
 
If you're saying "I think my problem description was perfectly clear, actually", I think it gradually became clearer as you added detail, but not much of it was in the first message.
 
m8_
No, I see the point
I don't think being snarky is necessary
 
"It didn't work" was in message #2, for instance
 
m8_
Just ask for clarification and I will gladly correct my poorly worded question
 
2:33 PM
Dont take any offense. "it didnt work" is just about the least helpful most frequent message people have to deal with, and have been dealing with for a while. I see your perspective, but do you see theirs?
 
Sorry, we keep telling everyone that "it didn't work" is never enough that it's hard to keep track of offenders
 
What I'm getting at by my "game this principle" message is that, if you know we're going to ask for clarification, then you may as well give all that clarifying detail before we even ask
 
m8_
In hindsight, @AndrasDeak
 
It adds extra burden of the people who are trying to help you, and at some point would discourage most people who face it over and over.
 
2:35 PM
You don't even need to think of it in terms of "I should ask self-contained questions because it's a nice gesture to the potential answerers". Instead, I offer a rational self-interested motivation: "I should ask self-contained questions because that way I get more useful answers more quickly with less effort"
 
m8_
I understand, and I'm not offended, I just think it's ok to make mistakes. I guess others don't
 
It's partly that I see you here often so I sort of assume you know how to ask by now
Feb 22 at 14:59, by Andras Deak
@m8_ "not works" how?
Anyway, I'm off to read in commute
 
Mistakes are good and healthy, if you learn from them
 
been struggling with rebuilding pandas dataframe from lists generated by iterating through previous dataframe as itertuples(). Thought best not to post it here as didnt want to spam chat
but if there are any pandas experts around any help much appreciated
 
m8_
I'm still learning, I suppose
 
2:40 PM
@Andy There's nothing spammy about earnestly asking a question :-)
 
The best thing to do is just ask; see the room rules though about hosting examples externally if they are reasonably sized blocks of code
 
ok thanks will do
will read through that before posting anything :)
 
It can make sense to hold off on asking a question if we're still in the middle of discussing an existing question, since waiting for a lull means you get our undivided attention.
but even when multiple questions are going at the same time, I do try to scroll up and make sure nobody got totally forgotten
 
Right now, I can rapidly feel my "but it's the right thing to do" vibe slipping away trying to learn unit testing for Flask :/ I could do with a break from staring at my broken code.
 
Ah, now I see that Andy asked his itertuples question on the main site. This is a nice case study of why it's not terribly useful to post a question on SO and then also ask about it in chat -- in the time it takes to read the room rules, you already got an answer.
 
2:51 PM
@roganjosh in my experience, testing flask code was usually quite nice
 
@Arne All of it has gone reasonably well until I have come to test my user groups and I've tied my brain in knots
 
Didnt have to test that as of yet
 
Accessing a page without having the correct user group on the user goes through a chain of code that results in a custom exception that then performs a redirect. I seem to be struggling to keep the context alive. I'll get it. Doesn't help that I'm learning unit testing at the same time
 
So i cant help
 
No worries :) It's one that I'm better just battling through anyway because it's teaching me quite a few things along the way
 
2:54 PM
But i can assert that testing code without user groups is enjoyable =D
 

« first day (3131 days earlier)      last day (1817 days later) »