« first day (3148 days earlier)      last day (1801 days later) » 

 
1 hour later…
1:39 AM
@Code-Apprentice closed
 
 
6 hours later…
7:25 AM
UnboundLocalError: local variable 'map' referenced before assignment
using map() inside a script, getting this error, tried that same snippet on IDLE, it works fine
 
"local variable 'map'" <- there's a clue. Builtins aren't usually local variables.
 
got see your point now, noticed another module using it as variable that executed before module where map() is being used
 
Hi guys
 
*got to
 
The default correlation method used in pandas corr() function is 'Pearson' right if I don't specify any methods?
 
7:34 AM
yes
 
Cool thanks @ParitoshSingh
 
no problem
 
8:07 AM
cbg
@AseemYadav The error solves your problem
 
8:26 AM
what is an efficient way to deal with questions like: stackoverflow.com/questions/56374285/…
where the code works but they ask for a one-liner? CV? Or leave them as is?
 
Ugh
 
well the one liner was groupby but it's grossly inefficient here, and I didn't want to post the answer but guess someone did
 
a removed ping, now i'll wonder forever what was said :P aah! the cruelty!
 
sorry i meant to tell u that the answerer got offended by your comment
 
@ParitoshSingh Lol, wish if there was a history button on a deleted message :P only on edited ones
@DeveshKumarSingh Me? i am not offending him?
 
ah. I hope it wasn't taken as offensive, though i do wish they didn't delete their answer
 
@AndrasDeak Voted to delete
@DeveshKumarSingh I answered another one
 
@U9-Forward i meant that for @ParitoshSingh sorry
@AndrasDeak done
 
@DeveshKumarSingh Oh yeah, Paritosh On rakesh's answer
Wow :P 5/5 answers all deleted :-)
 
cbg :-)
 
8:45 AM
cbg
 
@U9-Forward you used a pandas groupby instead of itertools groupby :)
cbg
 
cbg :-) i accidetally deleted it
@DeveshKumarSingh Haha. :D
 
stackoverflow.com/questions/56374407/… missed import statement and error in title and description don't match
 
9:01 AM
closed
 
Yeah, and one delvote by me
 
17
A: What is the Meta consensus on comments that self-promote answers to old questions?

Tim PostIt's as much noise as it is a symptom of the system not deprecating information as gracefully as it should. Work is on the drawing board to better identify (and allow for the community to elect) "Canonical" questions which can take precedence in searches, tag wikis, and other places. We've also g...

Canonical system in the works. I hope they do it differently from their usual methodology...
 
9:17 AM
does anyone know of import hooks that backport syntax?
writing async generators on 3.5 is driving me mad...
 
uh... that's not how imports work
unless you're talking about __future__ imports
 
I mean an AST transformer
similar to hy
just for Python3.6 to Python3.5, not cross-language
 
Hi again everyone
 
ah, got it. Don't know any, I'm afraid.
 
I am using matplotlib for data visualization of a dataset
The graph is correct but its truncating the last row/column
I am unable to find out how to fix this
Here is the code :
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_excel(r'C:\Users\rssld\Desktop\data2.xlsx')
corr = data.corr()
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(corr, cmap = 'coolwarm', vmin = -1, vmax = 1)
fig.colorbar(cax)
ticks = np.arange(0,len(data.columns),1)
ax.set_xticks(ticks)
plt.xticks(rotation=90)
ax.set_yticks(ticks)
ax.set_xticklabels(data.columns)
ax.set_yticklabels(data.columns)
plt.show()
Can someone help please?
 
9:28 AM
Matshow might use pcolormesh under the hood
 
by "truncate", you mean it is not visible on the plot?
 
I've only ever seen you use matshow
How about imshow instead?
 
I mean the row and column names are being shown but the color code is white which I didn't specify anywhere
Tried imshow as well @AndrasDeak , its giving a similar result
 
color code?
Then mcve or output please. I'm on mobile.
 
I can't send an image here right ?
 
9:31 AM
You can
 
Atleast not yet I guess
How?@AndrasDeak
 
Yeah.
Upload it to a dummy question/answer on main, copy the link here
(Then discard the dummy question/answer)
 
It seems I can't , I probably have lot of invisible negative reputation on my answers
Here is the link though :imgur.com/MuG13M0
Note the last row and last column
 
what value do these fields have if you access them directly?
 
9:47 AM
White would be nan
any chance there's a nan or more in your last column?
data.isnan().sum(0) or something can check
 
But it isnt null
There are values for that column
There are no nulls at all @AndrasDeak
 
10:02 AM
Then you have to produce a proper mcve
 
db.createCollection('dummycollection', {validator: { $jsonSchema: {bsonType: "object", required: ["dummyfield"], properties: {dummyfield: {bsonType: "string"}}}}})
This is vallid for MongoDB and the collection will be created.
 
@RaphX stab in the dark but what happens with ticks = np.arange(0,len(data.columns) + 1, 1)?
 
this will fail with pymongo
pipeline = {
    "validator": {'$jsonSchema': {"bsonType": "object", "required": ["interation_type"],
                                  "properties": {"interation_type": {"bsonType": "string"}}}}}
db.create_collection('_____interaction', validator=pipeline)
and this one executes just fine.
pipeline = {
    "validator": {"bsonType": "object", "required": ["interation_type"],
                                  "properties": {"interation_type": {"bsonType": "string"}}}}
db.create_collection('_____interaction', validator=pipeline)
any ideas why this is so?
 
what exactly does "will fail" mean in this case?
do you get an error?
 
The white portion increases @roganjosh
 
10:08 AM
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: unknown operator: $jsonSchema
 
I mean the width of that increases both row and columnwise
 
@RaphX check also corr for nans to be sure
 
@Nasrin I guess you should ask the MongoDB people
it's not really a Python issue
of course, you may get lucky and someone is familiar with pymongo here
 
Hi everyone, I'm using the library extract_msg to extract some infos about emails. Now, I want to save the attachments, but it doesnt work. I'm using that extract_msg.Message(f).attachments
 
looks like a pymongo issue to me. @MisterMiyagi since this works in MongoDB
 
10:13 AM
Has Anyone already tried to do something similar?
 
You need to be clearer than "doesn't work". What does that mean? Do you get errors?
 
@Nasrin the PyMongo docs refer to the general MongoDB groups for getting help
just saying you might have more luck there
 
@roganjosh No, no error, that's why I can not be clearer. I can paste you my code, but it would be anesthetic
 
@MisterMiyagi totally understandable :-p will go there then, thanks
 
Ok, well are you assigning the result to anything? Like attachments = extract_msg.Message(f).attachments?
Ok, so it seems the issue was that you were originally just throwing the result away?
 
10:19 AM
for attachment in aaa.attachments:
attachment.save(path)
 
I try to save them. I get no error, but nothing saved
 
There's just not enough info for me to go on. path could be anywhere on your system. How is the file name determined in that code?
 
@roganjosh aaa = extract_msg.Message(f) with f my email. And I'm sure about path
 
Is it an absolute or relative path?
 
10:22 AM
@AndrasDeak Absolute
 
huh
 
Please try attachment.save(customPath=path)
 
> Here is a list of things that are currently on our todo list:
[...]
Improve the intelligence of the saving functions
it might not be your fault
 
@roganjosh Well, now it works, thank you
I need to specify the argument name when my path is absolute then?
 
You're welcome. FWIW I had to go to the source code here
 
10:27 AM
no positional args
 
@AndrasDeak Ah ok, quite annoying. Cause it's quite intuitive to give the path as the first argument in a save function
Thanks anyway gyus
guys
 
it was roganjosh, but you're welcome
Do keyword-only args work on python 2?
 
But you have thought about it too ;)
I'm in python 3.7
 
> Python-Version: 3.0
@Mez13 I was wondering about submitting a PR to make these keywords explicitly keyword-only. That would give an error next time. But python 2 doesn't support them.
 
And strip the camel case, it makes me weep a little inside
 
10:30 AM
@AndrasDeak just try rather than ask
 
oh looky - a new room invite... woo hoo :p
 
you're always welcome, Jon :P
I thought we could get around the keyword-only argument limitation by using a *dummy rather than an empty * in the signature, but that's also something that doesn't work on pythoff.
 
Whoa, seriously?
 
>>> def foo(*dummy, arg='def'): pass
  File "<stdin>", line 1
    def foo(*dummy, arg='def'): pass
                     ^
    SyntaxError: invalid syntax
 
10:37 AM
I didn't know that. Guess I've unwittingly been writing py3-only code for years.
 
yeah, it just looks so...intuitive
 
what is your preferred quote, single or double?
 
triple!
 
triple single :P
 
ooh hmm lol
 
10:38 AM
no, triple double >:I
 
triple triple?
 
Single quotes have something of a.... je ne sais quoi
 
fite me
 
I prefer ' as it's a single key press rather than "shift + 2" on a uk keyboard layout...
 
Shift 2? That's the same as the Hungarian layout, cute.
 
10:39 AM
well, that's acceptable
I always use double quotes
Now here's another question - what's your opinion on escaping quotes?
 
OK, I'll be the hipster. It doesn't matter, just use black
 
I've developed a habit of using double quotes for error messages... because words like "don't" or "can't" tend to show up in those
 
@connectyourcharger I flip the default for that, just like python
 
@connectyourcharger what are they escaping from? :p
 
Like "This is a quote -> \" Interesting"
 
10:40 AM
ew
 
It's more of a javascript-esque style
 
but they don't know better :P
 
But I would always use the appropriate type of quote if I had something like that
Or quoted madness: """'"'\""""
wow that's actually valid
heh
 
✝_(º_º)
 
I think you mean "✝_(º_º)"
oh my god he just got bags under his eyes
 
10:44 AM
monospace font makes him fat
 
yes, yes it does
 
There's also a quadruple-quoted empty string literal (kind of):
>>> """"""""
''
 
is that string literal concatenation?
 
yeah, empty triple-quoted string + regular empty string
or the other way round, who knows ¯\_(ツ)_/¯
 
Sam
@PM2Ring Hey just seen this. When adding two classes, I'm basically just merging some dictionaries together.. atm we aren't taking many operations but the solution does need to scale so it's useful to know if this in inefficient.
 
10:52 AM
0,0-0,0:            ENCODING       'utf-8'
1,0-1,6:            STRING         '""""""'
1,6-1,8:            STRING         '""'
1,8-1,9:            NEWLINE        '\n'
2,0-2,1:            NL             '\n'
3,0-3,0:            ENDMARKER      ''
 
^ how'd you do that? O.o
as far as I can tell, neither ast nor dis can give that kind of output
 
old parser module?
just learned about that two days ago
 
shoved it in a text file and then did... python -m tokenize filename...
See: docs.python.org/3/library/tokenize.html - it's useful sometimes...
 
ah, tokenize. I've heard that before, but never used it
 
What kind of chatroom bans members for expressing an opinion?
 
10:59 AM
You're not expressing opinions - you're trolling... please don't continue to do so.
 
you should stop as long as I'm the one moderating you and not wait until Jon does it
we're done discussing this.
(Sorry, Jon, for the moves :P)
 
meh - no worries :)
 
@JonClements this is an interesting case study for the bee issue :P
 
not bees again? :p
 
11:08 AM
@roganjosh hehe
I wouldn't have made that connection but you're absolutely right
 
EVERYBODY DANCE NOW, WOOP WOOP WOOP WOOP
INB4: BANNED FOR SINGING
 
please don't
 
Please don't? I can't sing?
Woahhh, what kind of chat is this?
 
You can sing, elsewhere.
 
Elsewhere? so I can't interact in this chat?
 
11:11 AM
yeah, you can't sing. And you're not allowed to, either :P
 
Woahhhh, what a big rule there.
Not allowed to?
 
> As with any community, we have our own set of rules and etiquette. Please be considerate and take the time to read and follow them. If you are disruptive, users may not want to interact with you in the future. Room owners will use their moderation tools to keep the room on track.
everyone is welcome to contribute to the room in a way that isn't intentionally annoying or disruptive
people being accidentally annoying are warned first :P
 
It wasn't intentional, I can help but sing... its a habbit lol
Have you ever found yourself humming to yourself in the kitchen?
 
This is not the kitchen and we're not yourself. Stop.
 
Wonder if a 3rd account wants to give this a go before I crack on with some work... :p
 
11:14 AM
hehe, let me find a scooby snack somewhere...
 
Pretty harsh rule not being able to sing.
Everybody loves singing.
 
ugh
at least it's a good way to weed out ban-evasion accounts
 
Lots of new people today.
 
I'm not really new
Been on SO a while
 
@Aran-Fey do you have any actual users, or is it just yourself mostly?
I guess if any pythoff-users were stuck they'd have told you
 
11:19 AM
Most of my scripts have somewhere between 0 and 1 users
7
 
Here we go again
 
I've got some of my code on Github, but none of it is really documented or packaged, so...
 
@Aran-Fey that's at least safe ;)
I always wonder how often people just find code on github and pull it in
 
must be a full moon or something...
 
11:21 AM
lol
 
is there such a thing as were-trolls?
 
it starts if one bites you? :D
must be related to help vampirism
 
They are eternally at war
Never, ever allow them to be the only people conversing. It is foreseen that it will be the end of days
Also, probably a box-office flop
 
vampnado?
 
we already have a movie for werewolves and vampires. Twilight Series?
 
11:25 AM
Mega Were-Troll vs. Giant Help Vampire. I mean, I am a bit of a fan of Mega Shark vs. Giant Octopus. It's the logical sequel that never lives up to the first movie
 
I've yet to see any of these trash movies
 
I'm sorry, what is trash about a 500m shark taking a jumbo jet out of the sky?
 
@roganjosh What!! Mega Shark vs. Giant Octopus is an actual movie
 
@roganjosh apologies :P
 
@DeveshKumarSingh Not a movie, a masterpiece of cinematic entertainment
 
11:28 AM
@roganjosh and it's a franchise, Mega Shark Versus Crocosaurus , Mega Shark Versus Mecha Shark, all names sure to bring crowds to the box office And it's made by an American company
 
mobs, crowds... :P
 
WAIT, hold up. Mega Shark didn't die in the first one??
 
so... it's safe to assume that Mega Shark wins every time?
 
i've actually known about the Mecha Shark movie
I have a good friend who loves bad movies. You know, there are movies that are so bad that they are good. He likes the movies that are so bad they are bad all over again.
 
None of 'em can be as good as Piranha 3D with David Hasselhoff playing a life guard though... surely? :p
@AndrasDeak sounds similar to me :(
 
11:31 AM
@AndrasDeak I'm no different. Poultrygeist is a classic. The worst of the worst I've ever seen is Skinned Deep
 
"sentient homicidal car tire." i cant even begin to comprehend what that would be like...
 
the first link is a SO user profile?
 
yes :D
 
You don't have to, you can watch it
 
@DeveshKumarSingh whoopsie
 
11:32 AM
@roganjosh uhm.. about that... aah..
 
and why that particular user, I wonder :)
 
hehe
Prime examples: Birdemic (exploding birds terrorize the world) and Rubber (sentient homicidal car tire. Yes, you heard me.) [sorry, technical repost]
 
@roganjosh please tell me that has a line something like: "they're beeeeeaaakkk"?
 
@ParitoshSingh You can watch through your fingers if you're a bit scared
 
i think i value what little i have left of my sanity and free time :P
 
11:33 AM
how do you guys even hear about these titles
 
in Andras' case, a friend he can't get rid of :P
 
@Devesh other inmates in the asylum? :p
 
I only know about these two thanks to my friend. But I also had to watch clips from Birdemic :D
Rubber is on my not-to-do list
 
Well atleast when you watch them, you expect they are bad
 
I honestly thought the premise of Rubber sounded hilarious, but after watching the trailer... nah, it's trash
 
11:34 AM
@DeveshKumarSingh Yeah, but you never expect that.
 
@JonClements It's far more nuanced than to stoop to that (also, if it is a line, it really wouldn't be a stand-out moment with all the other garbage going on)
 
It's Ed Wood's Plan 9 level of trash
 
have anyone of you seen a movie called The Room (2003)?
 
The key is when films know that they're bad and unashamedly so
 
@ParitoshSingh is that "Hi, Mark" guy?
 
11:36 AM
If they don't try to be bad, like the first Godzilla remake, then I find them infuriating
 
Yes, that one
 
@AndrasDeak yep :P
 
ugh :P
oh it's the same movie...
 
Like Godzilla swimming past the Nimitz class aircraft carriers to get to a nuclear weapon hundreds of miles away. Apparently the nuclear powered boat right next to him was unappealing
 
how do you add a inline link in here?
 
11:37 AM
[text](url)
 
well, warheads have a different composition than fission reactors
probably more payload too
 
All we know is that he was powered by radiation or something something
 
@Aran-Fey thanks
 
although if you put all the fuel rods together it might be more than a warhead; no idea
 
Isn't it compression that actually triggers the blast?
 
11:42 AM
that's a hydrogen bomb, probably
 
A camera flash triggers two opposing pistons to smash the cores together
 
nuclear bomb is probably nuclear fission?
 
In a fission bomb ("atomic bomb") it's enough to put the critical mass in one place, remove separation. A fusion bomb ("hydrogen bomb") needs high pressure to initiate fusion, for which I think a fission bomb is used as a compression mechanism...
 
/me waves to the CIA/FBI and co. that must be watching this chat with some interest now... :p
 
And correct me if I am wrong, but fusion provides a lot more power than fission, but a fusion bomb is not achieved yet?
 
11:44 AM
Yes, I'm pretty sure the fusion is triggered by a fission stage but something has to be stopping a fission bomb just spontaneously exploding and I thought that required compression
 
> On the day of the accident, Slotin's screwdriver slipped outward a fraction of an inch while he was lowering the top reflector, allowing the reflector to fall into place around the core. Instantly there was a flash of blue light and a wave of heat across Slotin's skin; the core had become supercritical, releasing an intense burst of neutron radiation estimated to have lasted about a half second.[6] Slotin quickly twisted his wrist, flipping the top shell to the floor.
@roganjosh physical separation
@DeveshKumarSingh sure it is. My countryman Edward Teller was a huge fan. He and Ulam worked a lot on it.
 
@DeveshKumarSingh fusion is at work. In terms of the power industry, we still haven't properly contained it to have a net output of power. But for explosives, fusion is the second stage
 
@roganjosh Ohh yes, you are right, fusion is achieved but is not contained to be used in power industry, you are right, hence nuclear power plants only do fission I think
 
we're working on that, parallel development of inertial-confinement fusion and magnetic-confinement fusion
they would be way better than fission plants, but it's difficult :(
 
There are fusion power plants. They just don't really give any useful output. It's experimental work
 
11:48 AM
@AndrasDeak When you say we, does that mean we as in the human race, or we as in you in a lab with your team :)
 
we're much better at blowing stuff up rather than containing it. :P
 
we as in "the human race" and "physicists" but not me personally, not even close
 
I'll have to catch back up on fusion power actually. I've not seen anything about it for years and I don't think it's come up once in Brexit, but I though the UK and France had a collaboration on a pretty big experimental rig. Maybe I imagined it. At one point it was talked about quite a bit, so it's telling if it's not a consideration now
 
do you mean ITER?
or a newer one?
 
@DeveshKumarSingh Fusion bomb has definitely be achieved, and probably all nuclear weapons since the late 50's are now fusion H-bombs. The early bombs dropped on Japan were fission bombs. You may be thinking about fusion reactors, which have not yet been made practical or economically viable - the mainstay of nuclear reactors today are all fission based.
@JonClements Carnivore/Echelon trigger words galore here, so yeah, probly
 
11:53 AM
@AndrasDeak Skimming the wiki, I think I do mean ITER since it looks set for 2025
 
ITER has been going on for decades...
> Construction of the ITER Tokamak complex started in 2013
huh, so most of it has been planning
> ITER was proposed in 1987
 
that's a LOT of planning.
 
and we're going to break even within decades (we've been doing that for decades)
 
Possibly waiting on the local building inspector to approve some electrical panel somewhere - those guys have a HUGE backlog apparently
 
also chernobyl in '86 :P
 
11:56 AM
Heh... kind of sounds like the "planning/debate" on a 3rd runway at Heathrow... that's been going for for pretty much ever now...
 
It's a mega project though, so the lag is huge. When they send probes into space, the GC/MS tech, for example, is just totally outdated by the time it arrives, but you can iterate probes pretty quickly. I imagine just to get people round the table with money for fusion plants takes years in itself
 
one difference is that the technology to build runways has been available for a while :D
 
that just makes it worse though, surely :)
 
oh! i just realised i have a close link on questions now
 
Yeah, they don't have to worry about API changes in Concrete 14.0
 
11:58 AM
@ParitoshSingh yeah... congrats on hitting 3k on the dot :)
 
@ParitoshSingh heeey, congrats on 3k!
 
Congrats Paritosh :)
 
close flags are now close votes, so you almost never have to flag questions
 
sweet, i suppose its time i joined Arne then! pumps shotgun
 
If you ever feel like hating yourself and go to the close vote queue, remember that you can filter for close reason and tag. It helps a bit.
 
12:00 PM
Actually, Concrete 14.0 probably is a thing, and if "API" for concrete involves mixing/pouring/curing processes, then newer mixes probably do have new "API"s.
 
@AndrasDeak Heh, noted!
 
@ParitoshSingh Bravo! Hurrah! onto 5K now ;)
 
neat
 
It looks like sorcery to me
 
12:04 PM
@roganjosh you've reminded me I was listening to some old radioshow the other night and they were talking about various bits and bobs and someone was talking about how washing powder/tablets (whatever), basically make the water in the machine a bit more "wet" or something...
 
were they talking about surface tension and surfactants?
 
@JonClements You can lower surface tension
For example, if you splash water on a woolen jumper, you will see that it tends to form drops and very slowly penetrates the fabric. If you lower surface tension then the water will spread more easily
 
ahhhhh... surfactants rings a bell :)
 
but yeah... what both you guys said ^^^ :p
 
12:07 PM
Surfactants you can see in action in your own kitchen. Pour boiling water into a used frying pan. You'll see the oil forming small droplets all over the surface. Drop a blob of washing up liquid in the middle of the pan
 
you're just trying to trick him into doing the dishes
 
I can honestly say that I have no ulterior motives because I hate washing up and don't wish it on others :)
 
hey, does anyone here us Pylint?
*usePylint
 
you can edit/delete messages for two minutes
 
rightio... I'm going to grab a cuppa, do some cheesy beans on toast and watch last night's Taskmaster... (love that show...)
 
12:11 PM
have fun, Jon :)
 
I'll try not to get distracted by putting boiling water in a frying pan and then putting washing up liquid in it :p
rbrb in a bit
 
@Andy Mostly I use/ignore PyCharm's built-in code inspections
 
Aran-Fey mentioned Kitchen Nightmares a while back and I've just watched far too many now. I've not quite forgiven him for my lack of productivity
rbrb, Jon
 
@roganjosh is that the Gordon Ramsey thing?
 
Yes, where he yells at everyone and sends dishes back to the kitchen
 
12:14 PM
@PaulMcG ah ok thanks
 
@JonClements Yes. It comes with a very serious warning from me: there are a lot of series, he also does Hell's Kitchen and you basically can't run out of viewing material. Before you know it, we'll have fusion power before you break out of the cycle
 
I do @Andy do you have a question on it?
 
@roganjosh Sorry :D
 
Just don't do it again :P
 
12:18 PM
@DeveshKumarSingh hi Devesh, I was just interested if its a tool people use much. I am want to improve my style and make the code more PEP8 compliant
 
Yes, I use it in my day-to-day job, I have a pylint installed as an external tool on PyCharm and I do check for code style using it
it's good for maintaining readable code, there is also pycodestyle for this
 
ok perfect
thanks
 
additionally, you can hook it up in Continuous Integration via say Jenkins to run all your code through pylint before you merge your code, so bad coding style doesn't escape
 

« first day (3148 days earlier)      last day (1801 days later) »