« first day (2521 days earlier)      last day (2652 days later) » 

00:38
Hello.
I have a pandas dataframe one which I want to filter some rows according to a column dependent criterion. More specifically I want to only keep the rows whose values on column "room_type" contains the word "Entire".
I tried df["Entire" in df["room_type"]] which yields an error.
What's the proper way of accomplishing this?
I know it can be done by creating the index series with df["room_type"].apply, but that's definitely slow. There might or might not be a better way
exact searches would be easier
or even a handful of options
df["room_type"].isin(list_of_special_values) would be great in that case
 
3 hours later…
03:32
Have you guys used xmlrpc before?
trying to build a python app that can make calls to an rpc server and process them
my question to you is if any of you have built an app in python that does this and if I could take a gander at the code?
 
1 hour later…
04:40
@faceless don't use xmlrpc unless necessary
jsonrpc is better
in any case it isn't difficult at all
docs.python.org/3/library/… here's plenty of sample code, doesn't get more difficult than that
 
2 hours later…
07:03
guys are there any tutorial available for angular2 + python flask
 
2 hours later…
09:00
how to remove a descriptor from subclass... :D
09:17
as in, the parent class has a property but the subclass shouldn't have that property?
@AtharvaPandey use django rest framework it's better
flask is a pain for bloatware size websites
09:37
@people do you thing PYPY is a nice substitue of old Cpython underground implementation ? does it need VC++ redist packages for some libs?
 
2 hours later…
11:33
@Rawing yea :d
You fix your class hierarchy so that you don't have to do that :P
the actual need is that I want a metaclass to have a property, that would be available on the class-instances from that metaclass, but not on classes that are inherited' from that class-instance.
I mean, you couldn't do that with a normal attribute or a function either...
there is no literal hierarchy here...
they're metaclasses, but ... metaclasses still need to form a hierachy...
I was wondering if it is possible to write a mathematical expression in python that could calculate this kind of pattern:
eg. input is 11 then it will output 1.
input = output

3 = 3
__
4 = 2
__
5 = 1
__
6 = 3
__
7 = 2
__
8 = 1
__
9 = 3
__
10 = 2
__
11 = 1
__
12 = 3
__
13 = 2
__
14 = 1
I have already tried with something like: (input % 3) + 1
But that will only always calculate 2 right, and always swap around 1 and 3
11:48
@AnttiHaapala How about some __getattr__ abuse?
class Meta(type):
    def __new__(cls, name, bases, attrs):
        new_class = type(name, bases, attrs)

        def my_getattr(obj, attr):
            if attr != 'vanishing_property' or type(obj) is not new_class:
                raise AttributeError

            return 'some_value'

        new_class.__getattr__ = my_getattr

        return new_class
class Cls(metaclass=Meta):
    pass

class Child(Cls):
    pass

print(Cls().vanishing_property)
print(Child().vanishing_property)
I just realized I have no yammin' clue why that works.
Nvm, I just figured it out. I'm now impressed with my accidentally genius implementation.
@SebastianNielsen n//3*3+3-n
12:04
wtf?! how did you come to that conclusion
and that simple
basically it rounds up to the next multiple of 3, then subtracts the original number
Truly amazing thank you rawing
12:47
@Rawing wow that's awful :D
You can't expect to hide stuff from your child classes without some awful code :p
well I did solve it by adding a descriptor that throws an AE in child.
I wish Python wasn't so anal about metaclasses having to form a hierarchy...
13:17
@SebastianNielsen Learn how '%' works
>>> for i in range(3,12):
...   print(i, 3-i%3)
...
3 3
4 2
5 1
...
10 2
11 1
do you guys know how to replace the 2nd item in this list with a new name
['eminem', 'lil uzi']
>>> l = ["a", "b", "c"]
>>> l[1] = "x"
>>> l
['a', 'x', 'c']
cbg all.
Btw, the amount of Kevins in this room is reaching a critical level...
hahaha
Thanks btw
13:36
no problem
Kcvin looks like Kevin's smurf :-p
We can tell for sure that the color of Kevins is green though.
13:56
congrats on your 3k btw, enjoy those close / open review queues :)
hooray, another project that requires me to interact with ffmpeg...
I'm think I'm gonna take a preemptive break from programming so I can mentally prepare myself
14:18
More like FFSmpeg, eh?
aye. It feels like it can do anything you need, but nothing's easy to do
@ByteCommander So what we need to fight global warming is an army of Kevin-AIs
14:37
@AshishNitinPatil Thank you. I'm much more active on Ask Ubuntu though, barely touching SO any more currently.
15:04
This is not a Python specific question per se, but I'll ask it anyway. Is it common to compress your test resource files and then when running the tests de-compress them?
Right now I have a lot of HTML files that takes up a lot of space in my project, it would be nice to be able to decrease the size somehow
like 95% of the project consists of HTML, but it's a Python project and the HTML files are strictly for tests
Is it important whether it is common? Probably it's not common, but if it is suitable in your specific use case, go ahead.
No, I guess it's not important that it's common. But if it were I could spend some more time Googling around for information, because I can't find anything about it now.
Ok so it doesn't sound like a crazy idea at least?
If you can decompress them to RAM and not to the disk, it might be reasonable.
You lose the ability to have those files version-controlled properly though if you compress them.
Nope. HTML is often sent with gzip compression, so it's not a crazy idea to store HTML in some compressed form.
Good points, both of you. I'll consider if it's worth the effort. Thanks!
 
1 hour later…
AAB
AAB
16:29
Hi
16:49
I just stumbled upon an SO question about how to feed input images to ffmpeg via stdin... it had a bounty and 12 upvotes... and then I found a duplicate of it from 2012.
I guess the OP and at least 12 other people were really bad at googling.
lol
@Rawing Did you post an answer based on the other answer, and take the bounty?
bounty had already expired :(
17:12
Shame.
It's surprisingly difficult to generate high quality gifs... so far I've tried:
1) PIL - terrible quality & limited to 256 colors
2) imageio - uses PIL
3) ffmpeg - constant framerate
4) gifsicle - can merge images into a gif, but needs gif images as input
If anyone has any ideas, I'm all ears
I guess I'll try gimp next, but that's one heck of a dependency
imagemagick
not a python module I guess :P
Back again. Sorry about that my laptop overheated and switched off (again). No anything I know of for imaging uses PIL
I like the look of ImageMagick. I can't find it for Python3 (3.6 in my case) is it supported?
17:27
I just tried to pip install it and got some red text without an actual helpful error message
I'll just call it from the command line I guess.
this says it was modified a few months ago. I'd guess that means it supports Python 3
it's a swiss-army knife in the command line, so if you can get it to work it'll probably work fine
you might need to read a 500-page list of switches to get exactly what you want, but it's great
I guess you could only learn the parts you need.
I have to say, calling the imagemagick executable convert was pretty ballsy.
17:32
> -delay value display the next image after pausing
that's a helpful manual right there
hmm, this doesn't seem to support a per-frame duration
how can your use cases always be this weird?
high quality gifs without a constant frame rate are weird? okay :(
if I had a way to save proper gifs, I could post a perfect reaction gif now... but I don't :/
it seems they are fusing together individual gifs, this was my suspicion as a possible workaround
17:43
weekend cabbage
Don't you love when you look at your own code from a while back and can't figure out wtf it is doing?
@AndrasDeak That seems to work! I initially got the impression that I couldn't use the -delay for each frame; guess I was wrong
You're a life saver btw, you know that? Thanks.
glad I can be of help every now and then ;)
18:36
How terrible is it if I make a class with a list attribute?
And how much better is it if I call it list_ instead?
well cls.list won't shadow anything, will it?
or are you worried for the implementation of the class where list is a local name?
That's not it, I don't have any code in the class. I guess what I'm worried about is that most IDEs will highlight it, which could be confusing.
as attributes?
pycharm does it :/
18:45
...at least I could've sworn it does, but I can't repro it
Well... Geany does it :D
So, reading between the lines here, it looks like naming it list is perfectly ok.
19:11
Yesterday I updated my Visual Studio. Is possible that the update reset my python installed libraries? I can't find them, even I saved a txt inside the python folder with the name of all the libraries I have installed but now I can't find it...
@EnderLook I have three suggestions: 1. All files you create should be in your user directory, such as /home/username/ or C:\Users\username or a subdirectory of this directory. 2. Create a requirements.txt file in your project directory. 3. Use virtualenv.
@Rawing what is the warning/error from the highlight?
mmm, thas is strange: I have found a ".kivy" folder in users but I can't use that library, I'll re-install it.
@Code-Apprentice Yes, I shall learn how to do that about requirements.
As for your question, where is Python installed? Is it installed with Visual Studio or did you install it separately?
I installed python before
Typically a directory starting with . contains settings, not the actual library.
19:22
@Code-Apprentice Turned out I was wrong about Pycharm highlighting that, and Geany doesn't have anything fancy like warnings. It just changes the attribute's color to blue.
My python is in: C:\Program Files (x86)\Python36-32
@Rawing @Rawing That might be just syntax highlighting for class attributes, not an error.
@EnderLook how did you install the libraries? With pip?
@Code-Apprentice python -m pip install <library>
Not an error? You clearly don't know Geany.
no, I've never used Geany
I'm a JetBrains fan boy
19:25
You haven't missed out on anything.
Anyone know about a progress bar library where you import it with: from progress.bar import Bar I can't find it.
I don't remeber its name : (
progress 1.3 !!! Yeah!
also tqdm
does anyone know how to pip with pypy ?
and where is the idelib ?
19:41
hi guys !
i want to create a taxi booking form. I've all APIs for that. But i'll use this form as like advertisement banner in many websites. People can easily order taxi from different websites. But I don't know how to create it. I mean with which technology.
I need ajax form, right ?
I think HTML, CSS and Javascript is the right choice for websites
@RobertGrant thanks, but i meant another point
20:07
@ShaigKhaligli yes ajax through promises
20:46
@Idle001 is it possible to use form action to example1.com ajax in another website (example2.com)?
21:08
@ShaigKhaligli only if the receiver accepts cross-origin headers
I think the bigger issue is that who wants to be paying a coder to do something that he then goes on random internet chat to ask about how to do
You probably want someone who knows the basics already
well.... we were all beginners someday, we still are
Sure, as long as the employer knows that then it's fine. Otherwise it's not.
yes, therefor interviews and job contests exist, facing internet we'r all scholars lol
That makes no sense, but I doubt I'll get through.
21:22
lol.
21:53
I don't suppose there's something in the standardlib that lets me create duplicates of a file-like object?
I'm passing a file-like object into various functions that can throw an exception after reading a part of the file, so I need duplicates that contain all of the data
I assume that catching the exception is beyond the bounds of possibility?
Catching the exception isn't the problem - the problem is that the function has called fileobj.read() before it threw the exception, and fileobj isn't seekable.
(if a function throws an error, I try again with the next function)
Implementing a copy functionality shouldn't be overly difficult, but if there's something builtin...
what do you mean it's not seekable?
oh, file-like
so it's more like a generator?
pretty much
What I'm looking for is basically the itertools.tee of file objects
itertools.tee?
ah
22:02
Yeah I was thinking of tee
the itertools.tee of files is tee ;)
Well, I'd still have to write a wrapper that provides a read method
Which means I still need to have a buffer somewhere that keeps track of the unread data, so tee doesn't really do anything to make my life easier
Manual implementation ftw I guess
22:22
the real question is why your "file-like" object doesn't support seeking
I'd naively think that file-like objects can be sought in
I thought I'd be smart and implement my functions to operate on file-like objects instead of file paths, but I ended up shooting myself in the foot.
Didn't think trying to avoid any files being written to disk would turn into so much work
you just need more duck tape
[fry.jpg] not sure if typo or subtle joke
Actually, duct tape started as duck tape, from the texture of cotton duck. Than it was branded as duct tape, I think a bit akin to velcro/frisbee etc. But then the copyright thing was fixed and now things can be called duct tape. I read about this more than a year ago and the details are hazy.
but the bottom line is that both duct tape and duck tape should be OK
(as of my understanding from that while back)
22:38
Huh, interesting. I was sure it was a (very, very common) misspelling.
 
1 hour later…
23:52
what would you say would be the most secure rpc available?
I'm looking at RpyC, but this protocol is super transparent. I could get around it by using a VPN, but are there any other shcemas to getting around this?
@faceless nice addon does it work in python2 ?
yea as it seems anyways gn im off

« first day (2521 days earlier)      last day (2652 days later) »