« first day (2953 days earlier)      last day (1994 days later) » 

12:04 AM
cbg
So the win of this week is that we're rolling out Python3 at my job.
3.6, not 3.7, because one of our dependencies doesn't support 3.7 yet
but still!
 
\o/
3.6 is awesome
 
f-strings! built in venv! order-guaranteed dicts!
and a much easier upgrade path to 3.7! lol
 
the last one is cpython implementation detail
 
true, but all our (python) code is internal and nobody's using anything but CPython
 
You rarely want to rely on that anyway
 
12:10 AM
right
and 3.7 guarantees it as a language feature, and as soon as our last dependency supports 3.7, we'll be upgrading again
 
Great news :)
 
so I'm counting it :D
also moving to a more stable deployment strategy. Our existing one is awesome but archaic and home-brewed
Right now we're in the "our whole codebase can be run simultaneously on Python>=2.7 and Python<3.7" stage
but we're moving our internal systems to Py3 all this week, and telling engineers next week that Py2 won't work on December 1 and pulling all Py2 support.
The future's coming, yo.
 
jpp
12:39 AM
@JonClements, It's all these pandas questions! Almost free rep with non-exact dups. Nobody likes reading docs these days. [btw, if you answered all the questions you've commented on with answers, you'd be well past 100k]
 
@jpp gotta give others a fair chance and all that or something :p
 
jpp
Maybe on the weekend :). Sidestep all those homework questions.
When I get to 100k i don't plan to FGITW, will just wait for questions that either interest me or haven't been answered. We all need goals :)
 
not much to aim for after 35k rep and some gold badges :)
 
jpp
my main goal is to learn NumPy properly, ic an't find any good books
theres lots of material on Pandas / general data analysis, not so much on the intricacies of NumPy
 
all the top voted answers are stuff like "use x.split()"
 
12:44 AM
I think the thing is with numpy and pandas is that unless you have real-world use cases and something you want to apply it to, it's difficult to just run with the "I could do this but... why would I... what is it called... what should I try next..."
@Joran huh... but... x = range(3); x.split() - it doesn't work! :p
 
cbg
 
jpp
the worst one was: why is my first item missed in my loop for i in range(1, n):...
and then struggling to find a dup on indexing beginning at 0.
 
I'm just trying to brush up on JS these days... lousy at it... but seeming to need to step more into front-end than I'd like, so might as well, bite the bullet kind of thing
 
I feel bad for this guy trying to escape \u0001 as part of an API call ... string representations are killing him
@JonClements just learn typescript ... and use webpack (setting up webpack is a bit rough ... luckily its usually a one off)
 
1:03 AM
getting harder for this old puppy to learn new tricks though :)
I can fuddle through though - and with a reference manual and a bit of time can actually do better than some that purport to know JS :p
 
How many subplots can I have in a figure?
500?
 
@ex080 have you tried more than 500 and got an error ?
 
no I havent tried yet was just curious if anyone else had tried.
haha
So how did everyone get into python and in what year?
 
umm... toyed with it in 2002, didn't get into it properly until 2005ish
lack of curly brackes and forced indentation put me off for a bit, but then, once you realise you're basically doing that anyway to organise your code, it gladly become much more pleasurable...
 
1:20 AM
For me it was a about a year ago this week actually. I defined my first variable in any language in January of 2017. That language happened to be R.
I was instantly hooked. I vividly remember executing my first few lines of code. An almost tangible sensation of empowerment I'll never forget.
 
oh nice
 
You?
 
I have an invalid json problem, where should I ask about it? (I am using Python code, but the problem is more JSON related)
 
I started this year with pandas, matplotlib, and numpy. I picked up Fundamentals of Python: Data Structures by kenneth Lambert and am going through it on the daily.
probs here or JS chat. Doesn't hurt to ask
 
Thank you
 
1:32 AM
@Simon umm... are you using json.loads or similar?
 
But im still way beginner noob
 
I am trying to run json.loads() on a string, yes @JonClements
 
and the exception is?
 
Wait I just need to run it again to get the full error
 
also include the code how you're attempting to json.loads() it - are you trying it from an urllib request or reading from a file or... @Simon
 
1:35 AM
Yeah, for now I'm just copying and pasting in a variable for simplicity
My editor crashed :/
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    json.loads(a)
  File "C:\Users\Simon\AppData\Local\Programs\Python\Python37-32\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Simon\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Simon\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 353, in raw_decode
The Json is from an API that I cannot change the output of
Could it be the encoding?
 
In [2]: repr(a)
Out[2]: '\'{"_title":"Fortnite Game",
you've somehow got a "string" of a json response
 
cant u also add r in front of string?
then use json.loads
that works
 
@ex080 that applies to literals - not externally acquired data
 
Yes just tried it.
 
How r u getting data from the API? requests?
 
1:49 AM
However as mentioned by @JonClements, I am going to be requesting it from a url
urllib.request()
 
@Simon how the heck are you retrieving that... I asked... are you using the requests lib, or using urlib.request etc... ?
 
AH wait
:fingers crossed:
Yes I've got it working
I copied the json from a request, but I used print() to get it, so it formatted it.
Running a = urllib.request.urlopen() directly, allows it to work
 
2:08 AM
cbg
 
2:21 AM
what is cbg?
 
did not know that existed
also what's with the cabbage joke? I'm not getting it
 
3:09 AM
@ex080 Read the bottom of that page
 
Turnip orange banana, eggpland celery pear.
YAM
I guess I am a green bean
:P
 
 
3 hours later…
6:26 AM
cbg
 
 
2 hours later…
8:46 AM
hi I am new to Django, how can I use Django and JSON encoding as the backend of my sentiment analysis, I am confused where to begin....can anyone help?
 
9:17 AM
@AkhilAlexander that's very broad, what do you mean JSON encoding as backend? Do you want to provide an API for your sentiment analysis program or something like that? (Which accepts & returns JSON)
Any case, Django Rest Framework should be helpful to you.
 
9:42 AM
@shad0w_wa1k3r exactly!
 
@AkhilAlexander ^^ DRF is quite good, and is as famous as Django IMO (at least for REST ops), so there's plenty good documentation and examples out there.
@wim the release manager didn't want to bother with another version release just to compensate for his pypi mistake. So double release only on pypi, rather than everywhere. I might do the same, if I was in charge.
 
9:58 AM
@shad0w_wa1k3r thank you..
 
10:11 AM
can i ask python selenium related questions here?
 
 
1 hour later…
11:17 AM
Cabbage
 
11:30 AM
cbg
 
12:27 PM
cbg
 
1:10 PM
Whew - it's been a busy week. Still trying to get the intern's laptop working. Been chasing down dlls and null reference exceptions all this time.
I've beaten Oracle into submission with sledgehammer-like persistence, so the hard part is over.
 
doesn't it just grow new heads?
 
Only if you do slashing damage, which is why I went with bludgeoning.
That's why Hercules dropped a boulder on the hydra in the Disney movie, and also I assume in the myth upon which the movie was based
 
which, again, might be based on that book in morrowind where one guy has to beat another one that can't bleed.
I think it gave +1 to mace
 
He cauterized the necks en.wikipedia.org/wiki/Lernaean_Hydra
Not exactly disney-compatible
 
 
1 hour later…
2:36 PM
Hey Andras, excellent work on the recent Q&A. I stumbled across that yesterday and was impressed to say the least.
 
hey, thanks :)
I had a good run with it because first it went to HNQ, then it made it into the SO newsletter
 
Deservedly so... So is it considered good form to wait to accept on a high profile self-answer such as that?
 
Oh, good question, I don't know.
it probably doesn't really matter
 
I noticed that you'd not accepted and wondered
 
I mostly forgot
I was going to wait a few days to see if there are any critical responses, but by then I forgot about the whole thing
thanks, accepted it now
 
3:05 PM
Hi
I have an image of a closed curve, I want to implement a grid on it, and find blocks that my curve are in
I want to implement freeman chain code step by step
 
sounds like a good plan
 
any ideas to achieve this :|
 
start with an image, load it, bin it, do with the blocks as you please
 
how can i find bins that my curve is in them
 
do you know how you'll represent your image once loaded into memory?
 
3:18 PM
nope
 
so start there
you won't be able to reason about your problem until you understand how you can represent an image with an array
 
gande damagh
:)
 
28
Q: Understanding Freeman chain codes for OCR

SyntaxT3rr0rNote that I'm really looking for an answer to my question. I am not looking for a link to some source code or to some academic paper: I've already used the source and I've already read papers and still haven't figured out the last part of this issue... I'm working on some fast screen font OCRin...

After you get the fundamentals sorted the above link may be helpful
 
@W.Dodge thanks
 
@Sahar what language is that and what does it mean?
 
3:25 PM
@ThiefMaster github.com/pallets/werkzeug/pull/1397 when you get a chance let me know if you prefer one of these alternative Markup repr solutions.
 
no real preference
 
I think I'll go with the second then.
 
forgetting to cbg \o cbg
 
Needs a little adjusting though
Looking at the debugger so much during the sprint made me appreciate it but also want to rewrite it.
 
3:46 PM
@AndrasDeak persian. means a person who is mad and angry ALWAYS
 
Lol :D
 
;)
 
4:40 PM
hello all
I have question that I cant seem to find on stackoverflow
is anyone familiar with matplotlib
 
@ThePeskyWabbit You should post a new question. That's what SO is for.
It will help people with same/similar issues.
 
4:57 PM
you arent wrong, but this assignment is due in like 2 hours and I'm having one small issue. I will make a question and link it
 
@ThePeskyWabbit That's not what SO is for. Please be sure to review our room rules before posting your question here.
 
5:34 PM
I question the underlying assumption of "a question posted in chat will get an answer faster than a question posted on the main site". If anything, chat is slower since there's no pressure to be the fastest gun in the west
 
6:07 PM
ah. well then
ok
ty!
got it sorted anyways
and true about chat being slow... good point
 
...I know matplotlib :PP
 
user8729657
Is it possible to make a web scrapper to scrape flight results from this site? expedia.ca
 
Python is fairly adept at web scraping. urllib and requests are popular choices.
Whether that particular site can be scraped, I don't know.
Usually the biggest obstacle is dynamic content populated by javascript. Neither urllib nor requests will execute javascript.
Some people try Selenium for that, but I have no personal experience with it
 
user8729657
I've read a little about Selenium I think that would be a good choice for me to learn
 
6:26 PM
I got it figured out @AndrasDeak! thank you though. I was needing to draw circles at certain ax overlaps in a matshow figure
 
matplotlib
 
6:39 PM
Do we have a dupe target for "why does my string have a u prefix when I print it?"? how to print from json file using python could use it.
Along with a dupe target for "how do I get a particular value out of my json?"
 
what do you mean? this is stack overflow. everything is a duplicate
 
Yes, but that information is only useful if we have the duplicate stored in our database of useful dupes
 
TIL theres a database of dupes
 
sopython.com/canon to be specific
 
7:28 PM
lunch cabbage
 
7:46 PM
how can I print a number of something in python
 
print(3)
 
for example d 0s
d is an integer
 
print("0"*d)
 
thanks
 
I don't know why string multiplication isn't a feature of more languages. I think it's rad.
 
7:47 PM
and how can i append it to a string in a loop
d 0s,m 1s,k 5s for example
 
Have you considered reading a good python tutorial?
 
each one will be added in a loop and i want the final string
i am very very new in python
 
yes, that's why you need to learn it before using it
 
hi angry man :D
 
Create a list, such as seq = []. Inside the loop, use seq.append(the_thing_you_want_appended). After the loop, do print("".join(seq)).
 
7:49 PM
for the record while I am a grump, I'm very hard to anger
 
Or perhaps "\n".join(seq).
 
thanks kevin
 
A lot of people these days start using python for some pet project of theirs, which is great. But A lot of them forget to try to learn first, which leads to a lot of lengthy hand-holding discussions which are only entertaining for the first 10 times you're involved in one
 
I prefer to learn it while writing my damn projects
sorry to bother you
 
you'll finish much faster and end up with something way better in quality if you learn the very basics first
 
7:51 PM
I do think most early learners would benefit from some self-guided tutorial-reading.
 
but I have no time to separate them
 
Probably the reason I answer as many basic questions as I do, is because my early days were punctuated with frequent frustrations of the form "If only I had one good example, I could extrapolate a hundred other applications from it"
Oh well. I never did get those good examples, but I turned out OK. Mostly.
 
8:07 PM
cbg
 
Speaking of string concatenation, in REPL one can do:
>>> "a" "b"
'ab'
But that is just an artifact of REPL and there is no way to work that functionality into a function, right?
The "concatenation without an operator is what I'm referencing here"
 
String literal concatenation works everywhere, IIRC
 
C:\Users\Kevin\Desktop>type test.py
print("a" "b")
C:\Users\Kevin\Desktop>test.py
ab
 
8:12 PM
yah it does
 
Note that it only works for string literals, not string variables. a = "foo"; b = "bar"; print(a b) will not work, in the REPL or anywhere else.
 
I'm trying to display some images on an xy plane, with an x axis displayed, but no yaxis.
Is matplotlib the best tool for me to use, or is there something else?
 
Ah.. yes that's is the piece of info I was missing. The string literal aspect.
@IljaEverilä thanks for the link
@toonarmycaptain I have no idea, as you might guess, but I just skimmed the relevant matplotlib image tutorial and it looks like you can do whatever you want. It's kinda cool, IMO
 
8:28 PM
@W.Dodge It just feels rather overcomplicated for what I want, partly because it looks like there's about 6 interfaces. At the moment I'm trying to work out how to turn only the y axis off...it seems I can only turn both on or off, unless I use another interface, but that one doesn't have the method available that I found to plot an image instead of a point....
 
yeah, the axes docs suggests that you can only set visibility on both
Might not be the best tool. Then again you could use annotations to draw the x axis by hand matplotlib.org/users/annotations.html
 
8:47 PM
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

img=mpimg.imread('/home/will/Pictures/bug.jpg')
a_plot = plt.imshow(img)
a_plot.axes.yaxis.set_visible(False)
The above worked fine for me to display a picture without the y-axis
 
ah, I cool, I thought that didn't exist and I was too lazy to check
s/I //
 
Well I found it, but it wasn't pulling up in my IDE or working when I typed it by hand. I think it only works with imshow? That's what I mean by about 6 interfaces. I'm finding the object hierarchy pretty confusing
 
there are only two interfaces, the plt.* state machine and the object-oriented API via ax.*
That said, pyplot excels at plotting things "the usual way" so weird requirements are often missing. The other way someone wanted a way to swap the x and y axes in a figure. There's no way to do that without changing the underlying data (because that's not a thing you'd usually want to do)
@toonarmycaptain you may have issued the command before calling imshow. Imshow might create a new axes instance
 
Simply swapping the data would seem simple and obvious to me there.
 
yup
 
8:55 PM
I'll have to a deep dive into the docs, I guess, although the SO questions seem to indicate they're as hard to parse as I'm finding them.
But for now, rhubarb, have a good holiday, those who have it :)
 
rbrb
if you have specific questions feel free to ping me
 

« first day (2953 days earlier)      last day (1994 days later) »