« first day (3108 days earlier)      last day (2064 days later) » 
09:00 - 19:0019:00 - 00:00

09:00
@AndrasDeak @taritgoswami Checking first is a little slower, since .add checks anyway. The only reason to do an explicit check is if you need to do some extra stuff based on the result of the test. I've sometimes wished that .add returned a bool that lets you know if the added item is a dupe.
Thanks, that was my hunch
10:20
Is there any reason why we shouldn't delete this django vs asp.net off-topic?
Hmm, I didn't notice that it's from 2008. I guess with that the 17k views are marginal.
^ that
I see that HNQ stackoverflow.com/questions/55510485/… is now up to 7 del-votes. I wonder how many it'll take?
hover text says 1 more ;)
Excellent. Hover text is hard to read on the phone. ;)
I know
although on firefox for mobile if I long-press a link it displays the hover text, or at least the first part that fits in the small popup
Yeah, actually a list was given, which contains colourful socks, denoted with numbers, to find the number of paired socks. E.g; [1,2,1,3,2,1] - here we have socks of 3 different colours and as we have 1 pair of 1 and 1 pair of 2 we have total of 2 pairs of socks.

To solve this I took a set, scanned through the list and at a time if the sock is not in that set I added it(that's the need to check the condition) , and if it was there already I have increased the `no_of_paired_socks` and `remove()` the element.
10:32
@AndrasDeak That's handy. I'm sure I've tried that on Samsung / Chrome... Yeah, I just get the "what do you want to with this link?" pop-up
but now that I tried long-press doesn't work on the delete link, it just highlights it...
I don't know why that sometimes happens
ah, it works on the responsive desktop version, and I see that 1 vote is needed
@taritgoswami There are a few other ways to solve that. Eg, sort the list & pass it to itertools.groupby. Or use a collections.Counter.
user7437554
10:47
Hello guys, do you see any error in this short piece of code?
user7437554
numbers = [951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544,237]

for number in numbers:
    while numbers.index(number)<numbers.index(237):
        if number%2==0:
            print(number)
user7437554
It should print every even number below 237 (the list is longer, really)
And what does it do? Surely you can decide if it's correct.
user7437554
doesnt print ha
user7437554
:(
10:51
@santimirandarp Why are you doing two slow .index calls on every for loop iteration? And what's the while supposed to do?
user7437554
uhmm well I didnt know it was slow, and I suppose it completed the task
user7437554
is a condition to follow down the next line?
.index has to scan the list items one by one until it finds the 1st match. You should use enumerate so that you already have the indices you want.
@santimirandarp What will this print? while 1 < 9: if 1 % 2 == 0: print('hi')
@JonClements Regarding this: chat.stackoverflow.com/transcript/message/45979450#45979450, looking like i am
user7437554
but the condition you write doesnt change @PM2Ring
10:58
@U9-Forward :)
@santimirandarp Neither does the condition in while numbers.index(number)<numbers.index(237):
@JonClements You're still 2 away lol :-)
@U9-Forward everything's eventual
user7437554
But number index will change
@JonClements Haha, yeah :-)
user7437554
11:00
over the iterations, isnt it? @PM2Ring
@santimirandarp Each iteration of the for loop gives you a new number. But that number is fixed inside the while loop.
user7437554
@PM2Ring fine...you're right
@santimirandarp Do you really want the even numbers whose indices are less than the index of 237? Or whose value is less than 237?
Hi
user7437554
No, the index. There is a longer random list of numbers and I need just a slice before 237
11:05
How to delete multiple columns in Pandas Dataframe?
0


I am cleaning my large datasets which have 393 columns and 4838 rows. I want to keep only 56 columns and need to delete the remaining columns. I know the 56 columns name. I am trying to delete using drop function but it is taking too long. I would like to do in a loop for deleting the unwanted columns or any other easy method. I've seen some examples but this doesn't answer my question.

I tried with a loop but not successful.
just keep the 56 in a new dataframe
df_out = df_in[list_of_cols_to_keep] should work I think
ok thanks.
maybe throw a .loc in there for good measure :P (I don't use pandas)
@Jason Andras i right, but another way is:
user7437554
@PM2Ring just seen the solution on the web, thanks anyway..
user7437554
11:07
for number in numbers:
    if number == 237:
        break

    if number % 2 == 1:
        continue

    print(number)
@Jason depending how you're sourcing the DF - can you just not load 'em in the first place?
user7437554
that's what they wrote
df.drop(df.columns[101:361], axis=1, inplace=True) I used iloc to delete.. but it's taking very long time.
df = df.drop(cols_to_delete, 1)
Note that most columns will be dropped. Shouldn't keeping the few ones be faster?
no idea how .drop works under the hood
anyway, rhubarb for a while
11:08
rbrb
I need to check the csv file manually and then use iloc.. hence, taking very long time
seperating a data frame is a good idea.
thanks @AndrasDeak
@AndrasDeak Oh yeah, that's right, just realized, sorry.
user11285244
when you use webdriver , which takes longer? ,page loading or getting element. I mean I want to escape TimeoutException. where should I put driver.implicitly_wait()? Webdriver.Firefox() _____ driver.get(url)______driver.find_element_by_id() ______means putting area.
Hey if I want to present a histogram that looks like this: [1.1117e+04, 3.1900e+02, 4.6000e+01, 5.0000e+00, 0.0000e+00,
1.0000e+00], so 99.9% are in one bin. Is it ok to be able to visualize it better to only show the first bin with finer resolution? Do I even mention that one outlier in the last bin?
or the first 3 let's say
If anyone can tell how to loop then it would be great.. just for my learning purpose.
11:10
I'm not sure how to handle this. If I should show first one with all the data and then zoom in and show a finer one maybe?
I'm also rbrb'ing - at the point it seems that everyone is joining :)
@santimirandarp Ok. I'd do if number % 2 == 0: print(number), rather than using continue. There's nothing wrong with continue, but it's generally better to avoid it, when practical. Loops with lots of continue or break statements are harder to analyse than loops without such disruptions to the control flow. But sometimes continue does make the code easier to read, and less indented.
@JonClements I did..., i am ready to eat Rhubarb (just kidding, i mean i am ready to leave this room)
Oh no
i destroyed this bot:
in Sandbox, 1 min ago, by OakBot
Wadu hek.
Wadu hek waduuu hek.

Waduu wadu hek?
Wadu hek.
Wadu hek.
Wadu hek.
Wadu hek!!

Waadu hek.
rbrb
@Hakaishin Sweeping unwanted data under the rug isn't a good practice. But I guess it depends on the cause of the outlier. You could display all data and cleaned data. And you can certainly present a zoomed in view of the 1st bin to show important structure. But don't ask me how to do it in matplotlib, or whatever.
@Hakaishin BTW, did you conquer your catastrophic cancellation problem?
11:26
not really. Yeah I guess I will do it like this, show all and then pruned
user11285244
Can I ask a question?
user11285244
when you use webdriver , which takes longer? ,page loading or getting element. I mean I want to escape TimeoutException. where should I put driver.implicitly_wait()? Webdriver.Firefox() _____ driver.get(url)______driver.find_element_by_id() ______means putting area.
the problem is why I'm uncomfy to do that, is that the outlier is a bug, that I and my supervisors know about. They told me it is fine and to just leave it like it is, because the time for the project is over and because it happens probably very rarely, as my plots indicate is true. But I'm kinda afraid the professor will ask what is that outlier and I will have to tell him it's a known bug and we didn't have the time to fix it. :(
Which sheds quite a bad light on the project, I feel like. But maybe I'm overthinking and he won't ask
Sam
Sam
@AtsushiSakata What's the problem? Are you not able to find an element because the webdriver object has not finished booting? You should favour an explicit wait with an expected condition in that context... But I don't completely follow your question
But justifying manipulating data feels so tempting and easy. Like what is 1 outlier compared to 12000 other datapoints
user11285244
11:32
@Sam I just mean I want to escape TimeexceptionError with getting a lot of text which is in element.
Sam
Sam
@AtsushiSakata uhh, can I see some code?
@AtsushiSakata That looks like the same question you posted a little while ago. Please don't repeat yourself like that. If you really need to repeat a question (eg because it got overlooked in the middle of a busy conversation), you can link to it.
user11285244
@Sam my program get a lot of urls using for roop, then get elements from each page using webdriver.
user11285244
@PM2Ring no relation
Sam
Sam
@AtsushiSakata Yup but I don't know what's causing the exception to be thrown, therefore a code example would be useful.
11:37
@Hakaishin It's a slippery slope. So many old results in the social sciences are rubbish because of rejected inconvenient data. Most of the time, that was just due to poor statistics methodology, not deliberate dishonesty.
user11285244
:45989116 url_detail=url+"func=PCTopQuickSearch"
all_info_list=[]
driver=webdriver.Firefox()
driver.implicitly_wait(20)
try:
    for i in range(100):
        single_info_list=[]
        driver.get(url_detail)
        try:
            driver.implicitly_wait(5)
            url_1=driver.find_element_by_id("corpNameLink["+str(i)+"]").get_attribute("href")
            if url_1 not in all_info_list:
                all_info_list.append(url_1)
        except:
            pass
    driver.quit()
    return all_info_list
user11285244
this
Yeah it's a super slippery slope and I want to do the right thing. So how do I present this, in a manner that shows there are outliers, but also focuses on the majority of the data?
Sam
Sam
@Hakaishin Are you modelling with this data? Looks ideal for a log transform
11:42
what do you mean by modelling with this data? you mean apply the log to the data?
@Hakaishin Not sure. Plot the outlier(s) in a different colour? Maybe Andras will have some useful suggestions.
user7437554
@PM2Ring thx 4 your patience :)
Sam
Sam
@AtsushiSakata So apparently The TimeoutException will be thrown when the page is not loaded within specific time. I can see you have an implicit wait of 5 seconds before attempting to grab the element. Are you certain the page is fully loading within this time frame? You should really consider explicit waits. Implicit waiting isn't always reliable IMO
@Hakaishin Sorry, I should read the full convo first.
user11285244
@Sam explicit wait takes too much time implicit is shorter, just
Sam
Sam
@AtsushiSakata Explicit waits take as long as they need to, to resume normal execution of the program. Your implicit wait is likely not waiting long enough.
user11285244
11:52
use time.sleep(3) instead
Sam
Sam
No, that is still implicit. Something like
element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, "myDynamicElement"))
@AtsushiSakata Let me know if you have any questions regarding explicit waits.
How to sum up multiple columns in one column in Pandas
pandas dataframe
Hi. whats is the point of events emitter in node if I have emitter s and listeners in pairs?
instead of hey this thing triggered, couldl just just call the function associated to it
Is is better when async stuff triggers at random?
I would like to sum up 15 columns and store in seperate columns
sum['savings']=sum.iloc[11:26].sum(axis=1)
user11285244
@Sam thanks I am reading, if I can not understand I wil ask you
11:59
Any suggestion pleas?
Sam
Sam
@AtsushiSakata Cool :D
@JasminParent That sounds like a JavaScript question. What's it got to do with Python?
idk maybe iy could be a known pattern
@PM2Ring thanks for letting me to join your python room.Can we talk over skype or zoom or something? I have a kind of offer to you. It takes like 10 minutes talk over skype.
user11285244
@Sam what is my DynamicElement
12:13
@JasminParent Fair enough. There are a few different ways to organise event handling. Different frameworks provide different strategies. And I guess there are some benefits in discussing this stuff without referring to a specific framework, or specific language. OTOH, that keeps the discussion rather abstract, because we can't give concrete examples.
allright
@SardorIslomov Sorry, I don't do Skype. And at this stage, I prefer to keep discussions in a public space.
Sam
Sam
@AtsushiSakata The translation of the code I added is "perform a wait until an element (of the DOM) which has an id=myDynamicElement has been found. What you need to do is find an element which appears in all of the URLs you are visiting (I'm assuming you are scraping web pages from the same website). A usual safe bet is to grab an element from a navigation bar
@Pm
@PM2Ring do you have email? may be we can talk over email?.Its not public thing to discuss.I would appreciate to talk over email at least.
@JasminParent I don't know Node, but I have used frameworks that use that emitters & listeners pattern. I'm not clear on your actual question. Are you saying "why does the emitter send a message that the listener receives and acts on"?
12:20
why not just call the function firect?
direct
when is it used?
@SardorIslomov I'm sorry, I don't know you, and I don't give out my contact details to strangers.
@JasminParent You mean why doesn't the emitter just perform the desired action, instead of sending a message and having the listener perform the desired action?
Sam
Sam
@PM2Ring What if he has candy?
easier to reason about?
irs less fucky when all async?
question, does it make sense to club a lot of functions that logically speaking belong to a sort of data processing pipeline? It would make for one BIG class if i do make a class out of it.
but ive never done OOP, but it just dawned on me this pipeline does make a lot of sense logically speaking
12:25
idk lol
that it belongs to a class, each instance being the document being processed. Opinions?
@JasminParent Ok. This pattern is flexible. You can have multiple emitters broadcasting event signals, and multiple listeners. And they can do their stuff without worrying about synchronization, since events always have some kind of timestamp associated.
ah thanks pm
thanks for confirming my doubts
more flexible its is
it also means there's a segregation of responsibility. While working on the emitter, you just have to worry about the logic required for emitting.
yea yea hmm
I building a matching engine for a trading botmatching
logic is tedious
fill orders, canceled, partial filled, AHH\
12:29
one step at a time.
all happening whenever
I done it but its all spaghetti so re-writing\
thats fine. write the logic one step at a time.
the correct way
one function for each task
thibking about speed too
making eay for latter optimization
12:31
@ParitoshSingh Sounds reasonable. If all the functions make sense as methods. But methods can call functions defined outside the class. Don't just jam everything into the class. If a function could be generally useful with objects that aren't instances of your class, it may make more sense to define it as a separate function.
ah yeah, that can help keep the class down to a reasonable size
Thanks!
Sam
Sam
13:06
flask.pocoo.org/docs/1.0/patterns/packages I've been reading this which states its a good idea to have larger applications as packages.. When I do this and freeze my requirements.txt file I get the added -e {github link} requirement. This seems to be causing some problems however when trying to dockerise my application. My docker file attempts to download all dependancies from the requirements.txt file which fails on the github link as it's a private repo
Problems are arising because the repo is private. Is my flow completely wrong?
eh looks like I need an SSH key
@Sam I read a question a few days ago with exactly this problem, but I can't find it anymore. But I think you are on the right track
Sam
Sam
I don't know if its odd that my requirements file contains all the dependancies of the package as well as the package itself
you get the -e dependency because you work in dev mode, right? You have a setup.py file and installed your package with pip install -e . ?
Sam
Sam
yeh
ok, the answer is to not freeze an environment that has packages in it installed that are in dev mode
package your code with pip wheel -w here_go_my_wheels . and send it to wherever you want to install it as well
Sam
Sam
13:18
so should i just use pip install . instead
the wheel i mean
or did you upload it to pipy?
Sam
Sam
Nope - I don't want to upload it to pipy, It's private code
ah, just reread your question and saw that you want to dockerize it
it's easy then
Sam
Sam
do tell :p
I think what I'd do is instead of creating a requirements.txt and using it to setup the env in the container, to instead just put the whole wheelhouse in there
i think the command is just pip wheel -w wheelhouse
and then copy that folder into the docker image
then docker can do pip install wheelhouse/* and you're done
I can't test it right now on this pc, but if you run into problems I can try to help
Sam
Sam
13:24
Thanks, i'll try this now
> ERROR: You must give at least one requirement to wheel (see "pip help wheel")
seems it needs the dot at the end
Sam
Sam
Yup you're right just tried that
do you already know how to run flask from a docker container?
there are a couple of gotchas
Sam
Sam
Not atm :P happy for any tips - here's my current dockerfile
FROM python:3.6
ADD . /authservice
WORKDIR /authservice
RUN pip install wheelhouse/*
EXPOSE 8000
CMD ["gunicorn", "-b", "0.0.0.0:8000", "authservice"]
I'd not add ., it probably contains a bunch of stuff you don't need, like tests, tool config files, and source code
Sam
Sam
13:33
How would you structure that part?
you should only need to add the wheelhouse, and in case it's not part of the package, the app.py file that gunicorn uses to start the server
my Dockerfiles usually look like this
FROM python:3.6-alpine
LABEL maintainer="Me"
COPY wheel/* wheel/
COPY app.py app.py
RUN pip install wheel/*
CMD [ "flask", "run", "app.py", "--host", "0.0.0.0" ]
I don't have a recent one on my home PC so I had to guess a bit, but this should be 95% it
Sam
Sam
is you wheel/ supposed to be wheelhouse/ ?
yes
it's just a folder name, I guess wheelhouse is a bit more wheelhouse
I think you only need to expose the port if you run other container in your docker env that need to talk to it
Sam
Sam
So in my case I dont have an app.py my EXPORT FLASK_APP=authservice which references the package
does that mean that there is an authservice.py file that configures the server?
Sam
Sam
13:44
It looks for the __init__.py inside the authservice package
ahh
for what it's worth, I don't like that pattern much
but it works
Sam
Sam
I'll keep that pattern as is for now
yeah, I think you should have everything together to run it now, right?
Sam
Sam
So should I need to just copy the wheelhouse and not . ?
FROM python:3.6
COPY wheelhouse/* wheelhouse/
WORKDIR /authservice
RUN pip install wheelhouse/*
EXPOSE 8000
CMD ["gunicorn", "-b", "0.0.0.0:8000", "authservice"]
looks good
Sam
Sam
13:50
>>> docker build --tag authservice .
Invalid requirement: 'wheelhouse/*'
It looks like a path. File 'wheelhouse/*' does not exist.
did you create the wheelhouse in your local machine?
Sam
Sam
Yeh
then that might be one of those things that I guessed wrong
Sam
Sam
Well i just run the command in terminal if that's what you mean
that's the right thing to do
docker's COPY is just a little confusing sometimes
maybe declare workdir before the copy command?
could be that wheelhouse is at root and it can't find it later
Sam
Sam
13:52
ah that makes sense
2 secs
or do COPY wheelhouse/* authservice/wheelhouse/ instead
Sam
Sam
MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl is not a supported wheel on this platform.
The command '/bin/sh -c pip install wheelhouse/*' returned a non-zero code: 1
So I guess that error went away XD
oh markupsafe
i know that error =/
what arch has your workstation?
Sam
Sam
64bit
meaning, what does lsb_release -a or cat /etc/lsb-release return?
Sam
Sam
13:56
Im using Mac, those commands look to be Linux
well
that's a problem
Sam
Sam
oh really
i think the python base your are using in your container is ubuntu
Sam
Sam
ah
and many packages build wheels in ways that are not compatible
there actually is a solution to this
but at this point it might be easier to go back to the requirements.txt approach and just hack it something workable
Sam
Sam
13:59
Going back to requirements would it be easier to just add a ssh key to the requirement?
hmmm
Sam
Sam
Oh wait i installed it in dev mode which was wrong didnt i
you can probably still just copy your own wheel over
just not the complete wheelhouse
only authservice
lots of ways to get it to work afterwards. you can delete the line for authservice from the requirements.txt and just install it explicitly afterwards, for example
Sam
Sam
I could do COPY wheelhouse/authservice-0.0.0-py3-none-any.whl wheelhouse/
That lets me build the image
jup
Sam
Sam
14:02
Sweet - now I'm getting docker run errors HA
14:14
cbg
Sam
Sam
@Arne so my final dockerfile looks like this, all seems to be ok
FROM python:3.6
WORKDIR /authservice
COPY wheelhouse/authservice-0.0.0-py3-none-any.whl wheelhouse/
RUN pip install wheelhouse/* gunicorn
EXPOSE 8000
CMD ["gunicorn", "-b", "0.0.0.0:8000", "authservice"], "authservice"]
So I'm seeing something I don't understand. When I import a class using from v.w.x import y as vwxy and from x import y as xy, and try isinstance, I get different answers depending on how I imported the class, and my error message (which is testing passed type) says "expected type y, got type vwxy instead".
@Sam looks good
Sam
Sam
seems to be an issue in actually running though, with installing dependancies using wheelhouse
D=
14:22
How to ensure isinstance only uses the y part?
I can check back later, but gotta rbrb for now
sorry for sending you into the woods, sam =D
Sam
Sam
@Arne hahaha see you later!
Thanks btw
14:46
@toonarmycaptain How you import the class shouldn't matter. The problem must be something else, but I can't guess what it could be. We'll need a MCVE.
@PM2Ring I searched to know more about itertools.groupby() and found a good explanation here but I am not getting how this line is working(actually I'm not getting the working of lambda ):
you can't mix code and regular text in the same message
I wish I had a dollar for every time I've had to say that sentence
for key, group in groupby(things, lambda x: x[0])
The lambda creates a function that takes 1 argument and returns the first element of that argument
>>> (lambda x: x[0])('foobar')
'f'
The whole thing then groups all things by their first element
>>> {key: list(values) for key, values in groupby(['ab', 'ax', 'xb'], lambda x: x[0])}
{'a': ['ab', 'ax'], 'x': ['xb']}
What looks like is happening is when I import a class differently from how I import it where the isinstance is happening, I get isinstance evaluating to False when I would expect it to evaluate to True.
14:59
So, groupby() goes through the list ['ab','ax','xb'] , and creating partitions for each different x[0] values. Correct?
yes, but keep in mind that it only groups adjacent elements:
>>> [(key, list(group)) for key, group in groupby([1, 1, 2])]
[(1, [1, 1]), (2, [2])]
>>> [(key, list(group)) for key, group in groupby([1, 2, 1])]
[(1, [1]), (2, [2]), (1, [1])]
I will note that that repl session is occurring in folder dionysus/ where class_.py and student.py are in dionysus/dionysus_app/student.py and dionysus/dionysus_app.class_.py respectively
@toonarmycaptain Ah, yes, in that case it actually does matter how you import the class. As far as python is concerned, student and dionysus_app.student are two distinct modules, with two distinct Student classes.
You know what, this may be a case of Pycharm resolves my plain imports where a python repl in terminal won't...
>>> os.getcwd()
'C:\\Users\\david\\OneDrive\\Programming\\PycharmProjects\\dionysus'
>>> from student import Student
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'student'
>>> from dionysus_app.student import Student
It shouldn't have anything to do with PyCharm. student and dionysus_app.student are two different modules, that's all there is to it.
15:14
@Aran-Fey Fair enough, but unless cwd changes, I'm not able to import two different ways AFAICT. So as long as I don't mess with cwd and uniformly import throughout my application, this shouldn't be an issue?
Either the cwd or the sys.path needs to change, yeah (or you need to use importlib, or import __main__, but let's not worry about those...)
Inside of your package, only relative imports (i.e. the correct imports) should work anyway
:) the more you know. Thankyou.
15:40
@Hakaishin I'd use full plot + inset. If you know there's a bug don't hide its effects. Be honest. What if the prof asks why there's no artifact due to the bug and you have to confess that you manipulated the data?
@JasminParent why not ask JS questions in the JS room?
Sam
Sam
@AndrasDeak inset?
Sam
Sam
ah
@taritgoswami Here's an untested groupby solution to that problem:
from itertools import groupby
socks = [1, 2, 1, 3, 2, 1]
socks.sort()
pairs = sum(sum(1 for _ in g) // 2 for k, g in groupby(socks))
sum(1 for _ in g) gets the length of group g. We could do len(list(g)), but that has to create a list out of each group.
16:25
cbg. I hate asking questions on SO, I get either: (i) downvoted or (ii) question is being marked to be closed. And all that happens without any feedback at all. Awful. Mathematics is so much better. I think I was never downvoted on maths.
Thanks Andras, yeah that is good advice. I dont know why but I freaked out way too much, thought figuring this out is much harder than it was. Actually now I made an analysis of the outliers and the “bug“ is actually a difficulty of the problem itself and not a clear case bug.
But for a proper analysis of an approach you need to show cases that work and failure modes, and I did now a proper analysis of the failure modes and the kind of "bug" I thought happens often actually is very rare, like my supervisor thought 5 /10000. And the other failures are also very understandable.
@isquared-KeepitReal I took a quick glance at two of your questions and both had problems. this one is basically only answerable because it has a MCVE - if it weren't for the code, I'd have no idea what you're asking. And this one has the same problem, only worse - no clue what command you entered to get that error message. Your questions seem - for lack of a better word - incoherent.
But yeah, SO gets so much garbage that people can't be bothered to provide feedback all the time. If you want feedback, you have to ask for it
SO was much better in the old days than now..
16:44
@Hakaishin sounds good
@Aran-Fey plus feedback is "not welcoming"
"I don't understand what you're asking" is very hurtful and "library recommendations are off-topic" is blatantly elitist
Let's be honest here: We're programmers. We have trouble even just naming variables. Nobody should expect us to have the kind of literary skill that's required to sugarcoat "your question sucks, you need to improve X and Y and Z" for the newbies.
17:15
@AndrasDeak Yo o/
I used one global defaultdict and keep appending new data dict to it
How is this approach ?
17:29
"If it works it ain't stupid". Globals are usually discouraged but if it makes sense in your use case then it's fine.
Why they are discouraged ?
Because it's hard to reason about behaviour if content can change nonlocally
Oh that's fine then, shouldn't be a problem in my case.
I was victim of using too much globals when I was new to python, but I have since avoided them.
Function call here magically changes a value there. If you ask where the value of the global changed...good luck
17:31
Yeah understood
Yup :)
just because I was seeing 'avoid globals everywhere'
:)
Andras is right when he says, "Function call here ....." It did happen to me once.
I had to debug a lot to find the root cause
@PM2Ring Yeah the code works, but how it's working? groupby() takes the elements and the function to group with, but you haven't provided any function here
That's all explained in the documentation
17:42
Ok
@Aran-Fey I agree, those two are pretty bad
but the question I posted today, was perfectly fine
in any case
it got deleted? have a link for me?
17:59
I deleted it, it was marked to be closed. It does not matter :) I just got salty because every second question on SO that I post gets downvoted lol.
I figured out the problem myself eventually
Man, this brings back memories. cbg everyone!
Cbg, long time no see
Yeah, how's everyone doing?
Anything change while I was away?
Lot of the old regulars aren't that active these days. Otherwise cabbaging along ;)
18:12
Sounds good then.
Jon still here?
Well, glad to know the old puppy is still hanging in there.
How are things on your side?
Pretty good. Just been really busy with work atm.
Other than that, still doing okay.
Great! The good I mean ;)
18:14
How are things on your end?
Same job as before?
Fine, fine, thanks. Though I don't think we've interacted much :)
No, I don't think so either.
I do remember you though.
But i was last active here in 2017.
yup, I checked ;)
Still doing research, yeah. Academic work to the level of grading mid-terms as we speak...
Ahh well, grading... you gotta love that stuff ;)
Looks like Peter Varo is still here. I wonder if he's still working on pyglet.
Thiefmaster also. Thats good.
pfft, grading: print(100)
:P
18:18
But yeah, glad to see everything is still alive and kicking.
18:32
Any idea how I can add ticks to plots how often I want, but let numbers appear with a different frequency?
I have:
bins = arange(0.0, ranges[i], step_size[i])
ax.set_xticks(bins)
but I would like only every second tick to have a number displayed
either set manual ticklabels with empty strings (bad idea) or minor ticks
man ducky programming is the best, found it: stackoverflow.com/questions/20337664/…
oh, wait so the found answer is a bad idea?
@Hakaishin well, it's OK as long as the labels don't change (you don't zoom, resize etc)
It's fragile otherwise
Less fragile than manual ticklabels though
ok, seems to be good enough for my need
user7437554
Hello guys I'm trying to create very simple games to practice python, if you like take a look at: pastebin.com/yudYvTwv
user7437554
18:39
I'd be pleased if you want to share some idea of yours or give any advice
@GamesBrainiac meh.. shame on you :p
really pleased to see you pop in though!
how about the classics? hangman perhaps?
user7437554
nicee. Is hangman open source?
i uh..dont think the game is attributed to someone, or atleast i'd be surprised to find out if it is.
Hi guys
10
10
10
01
10
10
I have an input like above
I want to group it in this way : (10, 01, 10)
I am trying to use itertools groupby but so far I didn't succeed
Can anybody guide me regarding this?
18:52
how did you try to use groupby and what went wrong with it? code snippet?
from itertools import groupby
n = int(input())
for _ in range(n):
    a = list(map(int, input().split()))
b = list([k for k, g in groupby(a)])
print(b)
Output : [10]
09:00 - 19:0019:00 - 00:00

« first day (3108 days earlier)      last day (2064 days later) »