« first day (3113 days earlier)      last day (2059 days later) » 

03:06
Hi guys
There is this problem from a site :codeforces.com/problemset/problem/469/A
I wrote a code to solve the same:
n = int(input())
dum = set([i for i in range(1, n+1)])
p = set(map(int, input().split()))
q = set(map(int, input().split()))
dum2 = p.union(q)
print(dum)
print(dum2)
if dum2 - {0} == dum - {0}:
    print('I become the guy.')
else:
    print('Oh, my keyboard!')
However its failing for one test case reason of which I am not able to figure out
Would be helpful if somebody pointed out whats the issue with my logic
Here is the test case:
Input
3
1 2
2 2 3
Participant's output
I become the guy.
Jury's answer
Oh, my keyboard!
ignore the two print (dum) and print(dum2) statements, those were only for my checking
03:59
remove those prints anyways and see if that fixes things
and yes, 3
1 2
2 2 3 for this input, no one should be able to pass level 1.
the second line says there is 1 level that can be passed, which is level 2
you are, however, using the first value in p as well. @RaphX
oh yeah got it so stupid of me thanks @ParitoshSingh
it happens, no worries.
 
3 hours later…
07:36
Question on SO, does an edit rejection reflect negatively on someone in the background? this question has an edit suggested. Off of the original post, the edit would have been an improvement. At the same time however, or maybe i was earlier than him, i just edited the question anyways. So, now the proposed edit is basically a carbon copy with no improvements anymore.
What i wanna know is, should i take an action against the edit proposal now? or just leave it be
@ParitoshSingh edit clashes happen, I would not be against "no improvement whatsoever" -- see also meta.stackoverflow.com/questions/355512/…
i see, thanks
im starting to realise i should maybe use meta more often, just to atleast look up some of the things
 
2 hours later…
09:24
@Atsushi read the rules and don't ask for help with new questions here
09:55
I need to sum 2 columns but 1st row has string and rest all are floats, already tried stackoverflow.com/questions/42063716/… but unable to find a way to ignore strings while summing
@pythonRcpp I'm not a Pandas person but sounds like you are reading your data into a frame incorrectly in the first place, you should have titles and numbers instead of columns with mixed types
Oh, first row is string
So what tripleee said
my csv is like
a,b
c,d
1,2
3,4
And how do you intend to sum that?
hmmm, so why are there two header rows?
10:05
Very XY problem
and i need
a,b,sum
c,d,<blank or nan>
1,2,3
3,4,7
simple df['sum']=df.a+df.b would work if i didnt have 2 headers
these are not headers as such these are some string values only in 2nd row
>>> df
   a  b
0  c  d
1  1  2
2  3  4
>>> df['d'] = df.sum(1)
>>> df
   a  b   d
0  c  d  cd
1  1  2   3
2  3  4   7
You can mask the first row afterward. BUT, I can't emphasize this enough, this is a very bad idea.
your numerical data are all stored as object dtype rather than int, so you're losing a looot of performance because of that first row
I'd just separate the string row and work with the numbers
df['d'] = df.sum(1) # i need to specify columns i need to sum ( not all columns i would sum
so select those columns before summing, as you would always do...
this has nothing to do with your first row
any one having experience in Dash?
10:13
@Bhupesh_decoder Hello. I'm not sure, but we always suggest that people just ask their questions. If someone can answer and is willing to do so, they will. And a lot of users read the transcript later for interesting things, and they can reply to you.
Okay...Pardon me!!...It's my first time in rooms.
So, I want to animate my (dynamic) graphs in dash. Dynamic means the graph will change on selecting any other value in drop-down. I have gone through so many websites but they provide a solution with .js only with static graphs. I just want to ask if it is possible to animate such graphs. If yes, please give me a solution.
It's OK :)
This is plotly's dash, right?
hey, rene :)
\o
I joined because I left a comment on this MSO post mentioning this room.
Thanks for the heads-up. I think your description of the status quo is correct.
Okay, glad I didn't offend anyone from the start ;)
10:23
I never said that...
Being Dutch I preemptively assume someone is going to be offended, someday, somewhere.
Python is very good for Dutch people, by the way. And tulips too I guess :P
Yes, we Dutch are good in growing plants ...
something something grow in a pot
@AndrasDeak yess... plotly.Dash
10:44
Cbg
@rene yet you persistently post on meta with a panic-inducing number of unhandled reputation notifications <shudders>
I just wrote "typo" as "typio"...
how ionic
11:09
@roganjosh I have no idea what you're talking about ...
3
Aaarggggh!
Would it be considered white-hat to hack accounts for the sole purpose of dismissing notifications?
11:27
Grey-hat
sounds like it would at most offend one person. :P
And bring peace to another. "What is an ocean if not a multitude of drops"?
Sometimes the needs of the one outweight the needs of the rene
*outweigh, bah
The Cloud Atlas theft did not go unnoticed :) Walked to the ferry to end my holiday :'(
:(
at least you'll be back within reach of a Greggs
11:43
This is very true. Quite a slog to get back, but it does have baked goods at the end
12:09
@wim I was expecting some kind of backlash when that one finally got deleted. I guess that undeletion is better than a bunch of revenge downvotes. ;)
Hi, My question is bit vague: Is there any TimeSeries Relational Database which will also server most of Analytical queries as well. I know about timeScale, POstgress, GoogleSpanner, Mysql, influxdb and Neo4J
TSDB is one you didn't mention, but I don't know whether it would support "Analytical queries" (whatever they are)
@PM2Ring I disagree
12:25
@AndrasDeak Well, I disagree about it being undeleted, but I'm prepared to accept Martijn's ruling. And I must admit I did feel a little uncomfortable about del-voting it, considering all the lost points, even though they were highly inflated by the HNQ.
m8_
m8_
Good morning folks
12:37
@PM2Ring @AndrasDeak Unhappy with down-votes, lol :-)
@U9-Forward You got 154 points from answering that dupe. Stop whinging. FWIW, I downvoted the question, but I didn't downvote any of the answers.
@PM2Ring I am happy to get that, i know, lol i am not whinging, i am kinda just joking.
user7437554
Hello guys, I'm coming with a problem from a book
user7437554
I've solved it (I guess), just want to know if you suggest something different
user7437554
12:45
Write a function named right_justify that takes a string named s as a parameter
and prints the string with enough leading spaces so that the last letter of the string is
in column 70 of the display:

def right_justify(s):
  m= (' ')*(70-len(s))+s
  print(m)
right_justify('mariano')
user7437554
Do you think it is fine? (if not, please do not solve it)
@santimirandarp There is a rjust function:
>>> 'mariano'.rjust(70, ' ')
'                                                               mariano'
>>>
user7437554
What does 'rjust' stand for?
I guess it's right just, but i don't thing it stands for anything...
Anyways, it is function.
right justified
12:49
@ParitoshSingh That's right.
user7437554
Nice...there are functions for many things...
user7437554
thanks both
@U9-Forward you just said you don't know
@santimirandarp we say that python comes "with batteries included"
That 'dirtybit' is a strange guy. The link, below his twitter link, contains a string that is horrible(horribly dirty) as what google suggested...I searched for the link, wim posted about that 'hnq dupe', and got the info that dirtybit is suspended
@AndrasDeak I meant to say: "Oh yeah, that's right", lasy typing
12:52
OK
@ksalf nice!
Probably voting fraud
@AndrasDeak: Not just voting fraud, that man is you know... MUST be booted out for that 'phrase' usage
Hi Guyz i am newbee to the python. i need some suggestion.I am using OpenCV to detect Room flooring and apply colour on it. can anyone please suggest how to achieve it. I am bale to detect edges using canny algorithm.
i need to setup in mobile application
Between , I got 22/7 and I am happy as a PI :-)
@ksalf I just checked and they're suspended for voting irregularities (as rep farmers often are)
Offensive content in your profile gets reset if flagged but doesn't imply suspension
Yeah...but be assured the women of his country would want him to be banned forever, for what he describes himself there
@roganjosh: You were right about dirtybit's unusual (repo)rise...he is suspended
13:03
Hello everyone, how about you?
@ksalf that's not a concern for SO
@AndrasDeak: Yeah.
13:16
@ksalf interesting. They didn't do such a good job of covering it up :)
@roganjosh: When Sherlocks like you are after them, they do not have anywhere to find a shelter :P
Eh, all in a day's work-dodging
@ksalf 22/7 is a well-known approximation for pi, but what's not so well known is that you get a better approximation by subtracting 0.04%. That is, (1 - 0.0004) * 22 / 7 == 3.1416 exactly.
Another trick is to subtract 21.46% from 4
Another nice pi thing: 1 / pi == 113 / 355 is accurate to 6 decimal places.
13:28
Another trick is to divide a circle's circumference by its diameter. Very accurate results that way.
@AndrasDeak That's slightly harder to do as mental arithmetic. ;)
@PM2Ring: Thanks a lot, did not know that :)
@Kevin You'd need very good equipment to get better than 355/113 mechanically.
i just remember a few digits off the top of my head
In much the same way you need good equipment to calculate (1 - 0.0004) * 22 / 7. Don't try it with a calculator off the clearance rack, those tend to confuse their sixes and nines
3.14 seems to be good enough for most tasks though if you are not allowed to use calculators or what not
(which basically means most tasks involving tests and exams in classes :P)
In our exams, they would give pi value upto 6 decimal places :)
calculators allowed i presume though :P
:46035091 355/113 was discovered by a Chinese mathematician over a thousand years ago, IIRC. People were dabbling on the verge of inventing calculus for a few centuries before the big breakthrough with Newton & Leibniz. The Indian mathematicians probably could have beaten the Europeans by several centuries if they cooperated and shared knowledge instead of keeping it as closely-guarded family secrets.
@Kevin If you can multiply by 22 & divide by 7 in your head, multiplying by 4, and a subtraction should be easy. You do need to keep track of the decimal point though. :)
@PM2Ring: Never knew the Chinese relation, nice info!
About Indians(knowlegdeable ones), they had to guard the king's wealth among other things(weaponry), so probably tried to kept the knowledge secret
I have heard about that '9' a secret society
that was created to protect the secrets(knowledge) from getting into wrong hands
13:44
@ksalf There was also bragging rights: "We can solve stuff that you guys can't". Mind you, a similar thing happened in Europe. You could get famous and win bets in intellectual circles by solving mathematical problems. The method for solving cubic equations took decades to become public knowledge because of that.
@PM2Ring: Totally agree with you about that bragging rights.
Of course, Indians never brag about anything. :D
And that mentality still exists, everywhere
Thanks to open source thing, IT (eventually) got rid of it :)
but but.. D:
that's...completely different
13:50
@ksalf Because pull requests are all anonymous... right?
@piRSquared: :P
@PaulMcG yes, KNow TSDB as well.
@PM2Ring Not at all saying that, infact not supporting any culture(nationality) here when it comes to bragging :P
@ksalf Diversity is a core asset of Indian culture, but also a core liability. It gives India a culture of unparalleled richness, but it also limits India's ability to really unite its power. Which I guess is good for the rest of us, otherwise you could've conquered the rest of the world, centuries ago. If you wanted to. :)
is ksalf from India?
14:00
@AndrasDeak: An Asian here
That's a broad category :D But you're not obliged to answer anyway.
A great book about the history of mathematics outside Europe is The Crest of the Peacock. The author, George Gheverghese Joseph, is Indian.
I just didn't know if I missed some info
@AndrasDeak I may have misinterpreted one (or more) of their responses.
ah, OK
14:03
@PM2Ring: May be because English isn't their first language :P
I think it was (partly) this
9 mins ago, by ksalf
@PM2Ring Not at all saying that, infact not supporting any culture(nationality) here when it comes to bragging :P
m8_
m8_
can someone pass a generic way to filter one multi-index df by another multi-index df? Both the outer and inner index level are the same for the two dfs. So only get the rows where the two multi-indexes match
@roganjosh: If facebook stores my password then it's no genuine concern for me, really
I do not share much info there
Im not following sorry
But, when it (successfully) gains access to things on my phone that I do not want to share, through its app...it's bad
14:27
We're on tangents here. There's a massive difference between having a Facebook account and national infrastructure
yeah, I know
I am deliberately avoiding that, since I have already ask andras to remove some messages
Certain things must not be talked in public :P
m8_
m8_
for an example, I'm trying to accomplish the following, but with two multi-index dfs: stackoverflow.com/questions/33282119/…
not much point continuing a deleted discussion
agree, controversial too
14:31
Mmm, ok. I wouldn't myself think anything wrong was said here but things can be interpreted in many ways
No, I spilled something earlier that was bad
What you are talking about right now is ok
In [22]: df1
Out[22]:
                0         1         2         3
one   a  0.343532 -0.175621 -0.111565  0.034665
      b  0.708221  0.594460  0.539498 -0.430923
      c -0.016731 -1.287216 -0.121267 -0.976542
two   a -0.517278 -0.415616 -0.782319 -1.276900
      b  1.490889 -2.420397  1.486469  1.345989
      c -0.061998  0.716528 -0.149460 -0.412780
three a  0.538368 -0.382094  2.145429  0.324083
      b -0.957766 -1.441034 -0.888230 -1.281749
      c  0.629121  0.648637  1.038404  0.989201
Am just being cautious, nothing else, otherwise andras would be requested again :p...do not want him to be angry
is that it, @m8_? ^
@ksalf I wouldn't be angry but I would also not do anything to help :P
m8_
m8_
I think so @AndrasDeak, let me check a couple scenarios
14:34
@AndrasDeak: I know, that's why avoiding that topic (which involves bad-rep MNC)
so let's just talk about something else
sure
m8_
m8_
I think that did the trick @AndrasDeak, much easier than I thought. Thanks!
no problem
15:18
@m8_ @AndrasDeak .loc will break if any element of df2.index doesn't exist in df1.index. Use pandas.DataFrame.reindex
you can also do nifty tricks with pandas.DataFrame.align
otherwise to be careful you'd want df1.loc[df2.index.intersection(df1.index)]
m8_
m8_
15:35
thanks @piRSquared
@scitronboy yah, it's a thick circle
16:08
> python-monkey-business==1.0.0
^ from a project's requirements.txt
I just about swallowed my tongue when I saw that
@piRSquared noted, thanks :)
Does df2.index & df1.index also work?
Never thought to try. Checking
m8_
m8_
oh, good thought
Indeed it does TIL (-:
pd.Index([1, 2, 3]) & pd.Index([2, 3, 4])
# Int64Index([2, 3], dtype='int64')
m8_
m8_
awesome
user10984358
16:24
hey
@piRSquared - what wait... you didn't realise pandas had intersection, difference and such on Index objects? :p
I did. I just didn't connect the use of the operators &, -, |
ahhh okay... :)
I was getting worried there... thinking, hey, this guy knows way more than I do about pandas, and he didn't know that... omg! :p
See like they don't implement < like sets. They need their own different kind of <
So now that we've destroyed your worldview... what next?
I might try and answer another py3.x Q so I don't lose my python3.x gold badge should something happen to one.
16:34
yeah wow. 201! certainly in the danger zone
didn't realise it was a rarer badge than the Sheriff badge... (thought that was pretty much one of the rarest you could get)
so I'm the latest to get... and I'm not at all surprised to see the names on the "others with this badge" link - especially the first one :p
I'm 11 Q's away from the [tag: pandas-groupby] (-;
ahh my chat skills are terrible
From the top-users page only one person has that badge... I'm close to being the second stackoverflow.com/help/badges/8497/…
python3statement.org <-- and Salt is now officially part <3
@Wayne what happened to 'n'Pepper... :p
16:47
woot! (or whatever it is these days :p)
"woot!" will do
I mean, practically speaking we're still going to support older Salts still for a while, but our new stuff? Oooooh yeah!
besides that great news... how you been ?
Doing well - recovering from a "vacation" to DC :D
such a hardship :p
16:55
Sunday was not a good day for me. There were things trying to rise again that were definitely better left to rest :P
Must have caught some plague, not like there weren't a gajillion people there for the Cherry Blossom festival
I saw way too many innuendos in that, that any sane puppy wouldn't :p
@Code almost got the formatting right there :)
I desperately need help with a python problem that includes some mathematics/physics. I can't get the Crank-Nicolson scheme to work with the diffusion equation in 1D. MWE here: pastebin.com/GKi8kkY6
Has anyone good suggestion how to learn time series forecasting with recurrent neural networks and how to implement them with tensorflow/keras/pytorch if data will be given in csv-file?
@Code-Apprentice already done most (reasonable) things in there for my case. I've been trying to fix it for 8 hours now.
stick with keras or pytorch. Don't learn TF as the other two use it as a backend. Keras docs are pretty decent
web searches, ibuprofen, coffee, and patience. Those are my suggestions.
does anybody know hexdump command ?
hexdump binaryfile.binary
this will return hex data in terminal
but when i get them to a shell variable i got file name inside the print
@WayneWerner In that case, I can forgive you for that homework-like question on Physics. ;) BTW, the Google Calculator is great for calculations involving units, it even lets you mix metric & non-metric units together.
@underscore There are a few hexdump programs. They generally give you a lot of control over what gets printed, and how it's formatted.
17:20
@PM2Ring i want to get hex value from a binary file
and send hex data into message queue
But what does hexdump have to do with Python? With Python, you can do anything a hexdump program does.
thee are no shell chat here
so i asked from python group
Sep 16 '18 at 16:05, by vaultah
Jul 20 '17 at 21:05, by davidism
Jun 5 '16 at 21:44, by davidism
@Skullomania does that work in real life? "The McD's down the street was closed, so I figured I'd walk into this 5 star restraunt instead. Where's my $1 burger?"
May 25 '18 at 17:20, by PM 2Ring
Here's a hexdump function I wrote when I started on Python 3.6 https://chat.stackoverflow.com/transcript/6?m=30542743#30542743
@PM2Ring That's what I asked first. And it didn't work -_-
17:23
@PM2Ring i want a shell aproch
Heck, literally none of the results were remotely near what should now come up if you ask google "How many calories does it take to heat up one cubic inch of water by one degree fahrenheit?" :P
I expect Wolfram Alpha would do it, but I also figured that if anyone ever was searching for the same thing they wouldn't be aware of WA
@WayneWerner Well, your question comes up now. :) But to invoke the calculator, you have to write the "search" like a calculation. The calculator understands unit abbreviations, but it can also accept full words, like joule and inch.
@underscore Why is that?
If you manage to get Google Calculator to give me the correct answer I would happily change my accepted answer on there ;) lol
18:00
cbg
@piRSquared cool, cool, thanks
@underscore I want pizza
with pineapple you mean ? :P
18:17
With garlic
@WayneWerner Ok, that was harder than I expected. :) I couldn't figure out how to handle the degrees, so I had to cheat, and hard-code the ratio of 5 / 9.
(5/9)*(1 calorie/cm^3) in (calories/ cubic inch)
Should give 9.10392444 calories / (cubic inch)
Solved my problem. @Code-Apprentice It didn't have anything to do with the link you sent me, it was related to the mathematics involved in the problem :p
You can throw other energy units in there, eg joules. Or eV (electron-volts) :)
2.377442 × 10^20eV / (cubic inch)
I had to edit the ^ into that answer.
hartrees
(that's roughly 27.2 eV)
18:33
Simple unit conversions are easy. Eg, c in in/ns gives 11.8028527 inches / nanosecond
feet/ns should be better then
It's handy for astronomy stuff. It's got lots of constants built in, so you can do (mass of earth) in ounces
19:09
@mariogarcc The link I sent you would help you find any errors in the implementation of the mathematics.
@mariogarcc Glad to hear you solved it!
 
1 hour later…
20:27
If I write
for tu in list(itertools.product(a*b)):
    print(tu)
Will the product be computed everytime and take more time than storing the product in a list and then iterating over that list?
Here a and b are lists
what's "every time"? In every iteration of the loop? no
Yeah in every itaration
also there's no point turning the product into a list. That's just a waste of memory
for tu in itertools.product(a*b):
    print(tu)
much better
So, how this works?
Everytime the function returns one element?
pretty much, yeah. product returns an iterator
20:33
@Aran-Fey Ok , thanks :)
@taritgoswami Shouldn't that * be a ,?
@Aran-Fey ^
i.e. itertools.produect(a, b)
probably
@Code-Apprentice Yeah, I was actually using itertools.product(*A) where A = [ [1,2],[3,4,5]]
20:49
@taritgoswami that works, too
Dudes hello! Can somebody suggest how can I execute this curl command programmatically using python3, thanks.
curl -H "Accept: application/json" https://security.symfony.com/check_lock -F lock=@/path/to/composer.lock
Looks like the bulletin board has a new style. Good to see SE inc focusing on the issues that really need fixing
ugh, I don't like it
@vaultah o, seems like it has again become deleteable
21:05
I missed that message; yes, it was because the 2-day limit restarted
ah, I figured. Didn't realise mod un-deletions could do that
@AndrasDeak the board now takes up too much space because of all the pointless horizontal rules
I think it's the undeletion that did it
or no, I think it was the reopen-reclose that did it
ah
if not for the reclosure, it would not have reappeared?
if not for the re-closure it probably would've been deletable
got it
21:17
@DenisTarnavsky with the subprocess module
21:42
@DenisTarnavsky The requests module is pretty much the go-to for making remote HTTP calls
It's not in the stdlib, but an easy pip install
@DenisTarnavsky and with nifty pages like curl.trillworks.com you can turn your curl into python-requests without any work
22:12
Python and Regular Expressions is really neat combination
no, perl and regular expressions are a really neat combination
Help, I am looking at this question with from collections import deque and I cannot figure out how to return the output like the print statement does. Im not sure what the * piece of the print is
Basically print(*line_history, line, sep='') to return (*line_history, line, sep='')
''.join(line_history + line) if they are both lists or tuples?
Let me give her a shot :)
could be line_history + [line] if the former is a list
What is line_history? Type and type of its contents?
22:18
return ''.join(line_history + line)
TypeError: can only concatenate deque (not "str") to deque
I guess line_history + deque([line]) also works...
dpaste.com/3E28ZCW is the function Im spinning up
or maybe I'm overthinking it, and ''.join(line_history) + f'{line}' suffices
What does f'{line}' do?
it's an f-string
22:21
Hmm I get an syntax error on that line.
note that your comment mentions 25 lines and your deque has size 5 (might be correct, but not necessarily)
@ZackTarr then use modern python ;)
f-strings came in 3.6
str(line) can work too in that context I guess
Heckkkk I thought I was on 3.6
But nope Im on 3.5 on my work pc
That will be fixed tomorrow
waaait
is line a string? Then you can just concat that to the first term...
talk about overengineering :D
Hahah happens. And its a string yes.
I guess I just needed the .join logic
wim
wim
22:32
@AndrasDeak maybe user has figured out ways to game HNQ
there's a 2k rep drop due to "user was removed" so probably a sock puppet or voting ring
wim
wim
half expected to see U9 suspended too
Why? Answering dupes and low-hanging fruit is not a crime...
answering dupe HNQs is a boon, even
wim
wim
no just seen them having upvote me parties in this chat room a few times
I don't really think that went beyond that. People having voting socks of their own don't usually whine for votes from others.
wim
wim
22:39
dupes are good. need a way for dupes to stay, but without incentivizing dupe-answering and sock-puppets.
There have been plenty of suggestions, like removing rep from questions that soon get closed as dupes.
Also giving rep for finding dupes.
> @AndrasDeak: Thanks for the feedback. You're probably right but I don't feel confident closing for dupes. I've seen way too many posts which were wrongfully considered to be dupes. And it seems that you'll soon be able to close Python questions on your own. ;)
the response from a double gold badger whom I had told not to keep answering dupes
aspiring rep farmers are useless as gold badgers
wim
wim
I like both of those suggestions, but the second one only if OP has indicated dupe was helpful
OP indicating anything is out of the question. They barely read the "ask question" button before posting. The question not getting unhammered might be a much more robust indicator.
wim
wim
nah there are other indicators (detect if OP upvoted an answer on the dupe)
wim
wim
22:47
also the close dialog thing "thanks that helped me" which they see if it wasn't a hammer
23:27
...
;D
@Xilpex can you please stop that?

« first day (3113 days earlier)      last day (2059 days later) »