« first day (3347 days earlier)      last day (1590 days later) » 

1:41 AM
cbg
Pandas :(
 
2:27 AM
import pandas as pd

data = pd.read_html(
    'http://mmadecisions.com/decision/4801/John-Maguire-vs-Phil-Mulpeter')[6:9]

for datas in data:
    datas.to_csv("new.csv", header=False, index=False,
                 mode='a', encoding="latin1")
can i make the 3 tables side by side?
 
2:59 AM
solved.
 
3:25 AM
for url in urls:
    df = pd.read_html(url)[6:9]
giving an error
TypeError: 'NoneType' object is not callable
 
3:39 AM
urls is already list of urls. sounds strange. only after i did pd.read_html(str(url))[6:9]. it's works.
assuming that it's actually string .
 
4:27 AM
This looks phenomenal: an Advent of Code puzzle solution that works on Pythons 0.9.1 to 3.8
 
 
2 hours later…
6:25 AM
How do I use PyMongo for persistence?
Currently I'm just transforming my objects to a dict and pushing them to the MongoDB. Is there any better way to do this?
 
 
5 hours later…
11:09 AM
Is it just because I use it a lot now so I spot them more often, or has there been a big surge in Flask questions recently? Is there a SEDE for tag volume?
I can see one for total volume, but not against time
 
user12382982
12:09 PM
Hello
 
user12382982
Any beautifulsoup experts here to help ?
 
@VirendraSingh Hello. There are a few regulars here who know BS, but if this is about your fresh question on main please wait 47 hours before asking for help here, as per our room rules
 
user12382982
Why that waiting
 
Because asking in two places in parallel is not useful. Why spend time explaining the same thing in two places, especially since a lot of people are watching the main feed. After two days without a satisfactory answer we can be reasonably sure that you need additional pairs of eyes on your problem.
 
Because people like me get carried away and start discussing things in the room, which is invisible to people reading the question on main
 
12:15 PM
that isn't even a BeautifulSoup question
that's just "how do I loop over two lists simultaneously"
 
I'd add that as a comment, before this goes into a discussion of the question
 
bold of you to assume I have commenting privileges ;P
 
#plebproblems
 
worked out very well for me so far, though. I've hardly been on SO at all
 
That's given me a chuckle. I don't use hashtags, but when I do, they will be #plebproblems
What is the source telling people that np.vectorize is good? I'm almost tempted to think that this question is trolling
 
12:29 PM
ignorance and suboptimal naming
same as "they told me to use numpy because it's fast yet this loopy mess I wrote is slow, halp"
 
@ansev thanks for your prompt response. You got the problem perfectly. It's just that I want to use np.vectorize for fun as I never used and apparently its good. — Camue 10 mins ago
That's a little more than ignorance; someone presumably is extolling the virtues of it
 
What makes you think that other ignorant people aren't vocal?
 
Touche
 
I wish "I don't know what I'm talking about but np.vectorize is great" was a more realistic utterance ;)
 
Hey, it's the season for wishes. Maybe this year we'll get lucky :P
 
12:34 PM
Hi guys. I have a plot in python which looks convex (like it holds water). It is based on two sets of variables: data size and computation time. What can one tell about my data in this case? Im not a very theoretical person
 
I'm inclined not to believe that. Perhaps the library does something unusual. Do you have a test case?
 
12:47 PM
If it's based on 2 variables, does that mean it's a 3D plot?
 
 
2 hours later…
2:36 PM
hi can anyone help with audio arrays I have 2 arrays lets say a =[10,13,58,34,36,22] and b = [14,55,33] I want to see if array b is in array a within a range of 3 so the result would end up true as in 13,58,34 they need to be in order cos I'm using it to compare audio array patterns
hello
 
There's no python magic that makes that easy... you'll just have to write, y'know, good ol' loops and stuff
 
hi hows everybody
 
hi code
 
hi
 
bit quiet here you regular
 
2:46 PM
can i do a poll over here??
i just wanna know which code editor or IDE you guys use
 
sunday cbg all
 
id like a good free one the python 1 is poor visual studio most use
 
I use PyCharm (well, IntelliJ with the Python plugin, technically), but it's not like I've tried a bunch of different IDEs.
Between IDLE, notepad, notepad++, gedit, geany, and pycharm, I chose pycharm (because duh)
 
the thing is that python keeps changing code so better to hand write than let software do it
 
yea its true
 
2:50 PM
@CodeYard you might be interested in this survey results they have an ide section
 
@ParitoshSingh Thanks for those links
 
Cbg.
 
@ParitoshSingh are you from India
 
I am.
 
me too
 
2:53 PM
Nice :)
 
:)
 
@AndrasDeak That's me ;)
 
is anyone into audio at all
 
cbg @JonClements
@CodeYard i use anaconda
 
Anaconda is an editor? I thought that was an environment manager.
Btw, is anyone listening to any CS podcasts?
 
2:59 PM
@Dair it is :D
i overlooked
I use Sublime text as editor
 
@anky_91 don't you mean spyder/some other editor?
 
Btw, I use neovim (and occasionally VSCode for basically the Lean language)
 
@ParitoshSingh yeah you can use that too
 
anaconda is like a package deal, but i don't think anaconda itself is called the IDE. it comes with jupyter notebook and spyder
 
right
i thought editor is different from IDE :/
 
3:01 PM
sublime text sounds hardcore
 
It is. But they’re also similar enough that sometimes they’re used interchangeably
 
@ParitoshSingh Flipkart taught me that ;)
 
Purely technically speaking, you're actually right in that anaconda should be an IDE. but people tend to mean editors specifically
 
@Dair right :)
 
Much like C and C++ /s ;P
 
3:03 PM
@ParitoshSingh i was confused a while ago, thanks. Yeah I use Jupyter then and Sublime
 
Do you use Jupyter Notebook? Or Jupyter Lab?
 
notebook
 
Just a case of mixing the "face" with the "guts" over time so to speak. I've also just picked up how people mix IDEs to refer to the editor specifically, with the assumption that all the bells and whistles are in place
 
@ParitoshSingh A lot of emacs users will even confuse their editor with their OS.
 
Huh, cool
 
3:13 PM
So, I take it nobody listens to any CS podcasts?
 
In case of Anaconda specifically though, and i suppose in general, you need to have an editor in place for an IDE, but anaconda package management itself could be used with any editor. So i do think it's fair keep anaconda and IDEs segregated. That anaconda "ships" with two editors is just a side effect of them offering a super useful bundle to use.
 
anyone familiar with arrays here yet
 
You can safely assume that the answer to that question is yes.
Arrays are a very fundamental building block of most languages.
 
im not to sure lol
have you seen my question earlier
 
I think so, however i do think you should try to work through writing that logic yourself first.
Aran Fey gave a couple of hints towards what you should be thinking of when trying to figure out how to make it work
 
3:19 PM
@Dair counter strike? :p
 
I can do text in text but can't work out the for loop or do I need 2 while loops
 
Creep score?
 
@JonClements My undergrad had a Chicano Studies lol. So you could be a CS Major.
 
@michaelspencer you shouldn't need two loops, but write it with two loops if you must at first. See what you can come up with, try to search online if you're stuck.
Better yet, can you figure out how to "logically break down" your desired output into an approach that you can code with?
Essentially, if i have a small list and i need to find if it "fits" within a large list with a certain tolerance, what should i be assessing?
 
I don’t entirely understand the problem. Why does ordering matter if you just return true? Can there be spaces within elements?
 
3:22 PM
The ordering part simply means that [1, 42] is not close to [42, 1].
 
Ok, are spaces between elements allowed?
 
From how i interpreted their statements, nope.
 
Ok, because if spaces are required, you will probably need two loops. If their contiguous it is not nearly as bad.
 
it 2 audio np arrays I'm trying to find similar patterns within a range to find phonemes
searching google for specific thing is impossible
im not sure how to compare the files google just throws up sphinx or python speech recognition module
 
@michaelspencer Ok, just worry about the list problem first, don’t add np into the equation yet. Can you write pseudo code for it?
 
3:27 PM
learning how to google things will also come with time. Generally, you don't get exact answers for your "big" problem, but you get answers for your "pieces" one by one. The art of breaking a big problem into small pieces is essentially what programming involves.
 
@ParitoshSingh Or more generally just problem solving in general.
 
And you've done a good job at it so far, by identifying that you can try matching "small list/array" inside a large one as a criteria for two audio clips to belong together
So, keep going! 1 more step.
 
I'm pretty new new to python and have solved most of it I just need a way to standardise files to compare
 
yes, if you have a list of length 3, and a list of length 6, you can't really compare them. So what can you do about it?
 
im just looking for a snippet of code an example of my question then I can adapt and fiddle to do my longer task
can I turn into a string remove the , and compare somehow
 
3:32 PM
but that might not really teach you anything if you just lift code up. Do you have a "thought" towards what you want to be doing to get a comparison between the two lists/arrays here?
@michaelspencer Ah. Clever, but you introduce more problems for yourself if you lose out on the "numericalness" of the items being compared. This might have worked for an exact match using in comparison for strings, but you can probably assume there must be a better way
Even for exact matches, it's generally not a good idea to just convert something into a string and do you work that way
 
I've got a design problem: I have an abstract base class, and a mixin that slightly alters that class's behavior. Now I want to subclass the abstract base class, but I can't find a good way to implement the functionality I need - I can either re-implement large parts of the original class with small modifications, or I can change the interface (in which case the mixin won't work with the subclass). Basically something like this. Any ideas?
 
I know its complicated is there a set method you may suggest fingerprinting getting a %age its hard but once I know this method I can get the results
 
i have a pandas proposal for that , would that be okay?
 
I have pandas
 
cool then
 
3:39 PM
you mean pip3 pandas right
 
no i meant a pandas solution to your array problem
 
well I meant are you specifically looking for a solution in numpy? I am not good at that, But i have a proposed solution using pandas if that's okay
 
do you mean the python module pandas
 
yes
 
3:42 PM
yes any python method is great
 
lets create 2 dataframes as
a= pd.DataFrame([10,13,58,34,36,22],columns=['a'])
b=pd.DataFrame([14,55,33],columns=['b'])
then you can make use of merge_asof
threshold=3
m=(pd.merge_asof(a.sort_values('a'),b.sort_values('b')
   ,left_on='a',right_on='b',direction='nearest'))
m[m['a'].sub(m['b']).abs().le(threshold)].groupby('b')['a'].min()
Outputs:
b
14    13
33    34
55    58
Name: a, dtype: int64
 
@Aran-Fey I don't quite see the problem here. Doesn't class Derived(Mixin, Abstract): work?
 
to convert into a np array you can use m[m['a'].sub(m['b']).abs().le(threshold)].groupby('b')['a'].min().to_numpy() which outputs array([13, 34, 58])
 
@MisterMiyagi I don't want the ChunkedDataTransformer to always inherit from SymmetricMixin, that should be something the user can optionally do. I'm looking for a way to implement ChunkedDataTransformer in such a way that it still works in combination with SymmetricMixin, and without copy/pasting 4 functions from the base class if possible
 
Lol, 21. Nice.
 
3:48 PM
I guess option 3 would be to go with option 1, but additionally implement the 2 new abstract methods in SymmetricMixin as well. And drop the @abc.abstractmethod decorations (because you only need to implement transform or the new transform_chunk method)
Option 4 is accepting that the mixin doesn't work with ChunkedDataTransformer, and implementing a SymmetricChunkedDataTransformer
 
This doesn't really answer your question, but I'd suggest to reconsider why "DataTransformer" is an Abstract class and provides some implementation. Your problem might be better modelled with one ABC and two partial implementations.
 
thanks anky waiting for pandas install
 
At least from looking at your example, I'd say "Option 2" is the correct one since ChunkedDataTransformer and DataTransformer are not the same kind of transformer when considering their innards. Since that basically replaces the entire partial implementation, going for a pure abstract base and separate partial implementations seems most natural.
 
no problem, let me know how it goes @michaelspencer
 
@MisterMiyagi Hmm, yeah, I think you're right. So now I just need to figure out how to split them apart without having lots of duplicate code...
well, near-duplicate code I guess
 
3:55 PM
I'm working on raspberry pi I don't actually understand what it is as such but its a method to start with I sort of follow it to a point I can alter bits
 
Rbrb. Gonna do some math.
 
An alternative would be to separate transformation and read/write, e.g. via composition. It appears the two are separate responsibilities. Your mixing doing only the transformation also hints at that.
 
Actually, I need to think about this some more. My real code has some additional details that require consideration. Thanks so far though
 
I just watched some guys throwing a nokia, iphone and samsung S10 out of a helicoptor at 1000ft
spoiler alert: all 3 survived and ran.
 
Hi, um I just wanted a quick confirmation. If I have a dictionary and I do something similar to this:

dict.get(key, -1) == 0:

Does this basically check if the value of the key is -1?
 
4:10 PM
no
 
Could you please explain how this is working then?
 
the comparison is happening against 0. is it the .get part that is confusing you?
the .get method on a dict is used to return a default value if a key is missing. When a key is present, it just returns whatever value is present for that key
 
Oh! I see.
So it is basically saying that..
If the key exists, compare that to 0. If it doesn't exist, assume the value is -1, and compare that against 0?
 
basically it's equivalent to key in dict and dict[key] == 0, yeah
 
Thank you!
 
4:13 PM
aye. and i would rather write it more explicitly like ^ this
 
It threw me for a bit of a loop when I saw it.
 
@Rietty help(dict.get)
see also online docs
Side note: don't call a dict dict because then you're shadowing the built-in name dict
 
4:52 PM
hi anky I tried that how do. I print out what your output was I did print m and got 2 lists of 6 not same as your output also I noticed you changed the order of the numbers they need to stay in order really
@anky_91 hi how do I print your results no output I printed m and got 2 lists of 6 also I need to keep numbers in there order
 
i dont understand, could you try below
a= pd.DataFrame([10,13,58,34,36,22],columns=['a'])
b=pd.DataFrame([14,55,33],columns=['b'])
#then you can make use of merge_asof
threshold=3
m=(pd.merge_asof(a.sort_values('a'),b.sort_values('b')
   ,left_on='a',right_on='b',direction='nearest'))
final=m[m['a'].sub(m['b']).abs().le(threshold)].groupby('b')['a'].min()
print(final)
 
yes that's the 1 perfect output now can I keep numbers in original order if not ill work summit out but that code is my starting point thanks for that mate
 
no problem
 
Hi, I have been attacked by sn1per ransomeware. Which encrypted my entire hosting account files and folders and demands bitcoin to unlock.
 
@ARJUN hello, ouch.
hope you get over it somehow
 
5:05 PM
here's to hoping you have backup?
 
you have no cloud backup
 
@ARJUN There is a guy who dedicates his free time to fighting that and has had several articles written about his efforts, he has apparently helped a bunch of people fight ransomware attacks, His website is here
 
I wonder if there's an Abnormal, Illinois
 
"Superhero of Normal, Illinois" is a great line
 
Speaking of which, I should probably disable the disk that holds my backups on Windows...
 
Anyone here have experience with the arxiv API? I'm having some trouble with non-standard characters and the search query.. It's a bit weird, because if I search on their website arxiv.org/search/… gives results whereas export.arxiv.org/api/query?search_query=au:Nygård_J has no results. The chat seems to break the URLs, sorry. The Arxiv API doesn't mention special characters anywhere sadly..
 
stackoverflow.com/a/59346267/9840637 should be a comment at the max
^^ closed , thank you :)
 
@user129412 I seem to remember that arxiv seems to ignore accents (at least in web searches). Have you tried normalizing your urls (so that Nygård becomes Nygard)?
 
I have tried that, but sadly something weird seems to happen then. The search function on the website returns all relevant papers, like you suggest. The API however only returns papers in which the authors misspelled Nygard with a normal a
I've also tried using Nyg%C3%A5rd_J, which has no results again..
 
hmmm
 
5:24 PM
recbg
 
'http://export.arxiv.org/api/query?search_query=Nygård, J' works
 
Works how? I tried that and got an empty-looking result back
ah, no, I tried underscore
 
At first sight that just returns everything which has either Nygard or a J, if I am not mistaken?
Because none of those authors are in fact mr Nygard
 
same as the web search never mind
 
I tried looking up groups.google.com/forum/#!forum/arxiv-api but no easy search hits
 
5:27 PM
I think it does an OR on nygard and J
(the comma, that is)
Maybe I will just send them an email.
 
:P
the name listing says J. Nygard for the unaccentized version, perhaps you should try that
lol
<author>
  <name>Kim Nygard</name>
</author>
<author>
  <name>J. Friso van der Veen</name>
</author>
 
Sadly it misses papers, I know he has published in 2019 (I can find an example) but the first/most recent result the API gives if I use Nygard is from 2018
 
I think Nygård,+J does what you want
 
arxiv.org/abs/1809.10479 here they forgot the accent, here is one with arxiv.org/abs/1911.04512
 
@user129412 scholar google com gives many
 
5:34 PM
@Aran-Fey 'http://export.arxiv.org/api/query?search_query=au:Nygård,+J' is again only false positives for me
 
even on arxiv :P
@user129412 maybe it is latin1
 
can np.frompyfunc be used over np.vectorized? if so, is it faster?
 
@anky_91 yes and no, probably
when in doubt, time it
 
okay :) thanks, i have seen a few answers comparing it to numba
@AndrasDeak right
:)
 
5:37 PM
I have to run now, thanks for the help in any case :) If I figure it out I'll let you know what the answer was!
 
@anky_91 if the function you're calling it on is written in c (like most builtins) I suspect it can be pretty fast
but that's not the typical use case for trying to use np.vectorize
but I'm not sure as I've never used frompyfunc
 
i can understand for np.vectorized , it's slow
@AndrasDeak okay no worries
here is an usecase if you're interested :)
 
@user129412 fish slapping dance for you for not reading the api docs.
 
@anky_91 you linked me to a numba answer
 
the author queries are prefixed with au:
@user129412 hence: http://export.arxiv.org/api/query?search_query=au:"J. Nygård"
 
5:43 PM
@AndrasDeak sorry the question would be stackoverflow.com/questions/56904390/… and the frompyfunc comes here
 
@user129412 and the results are paged too, 10 results on the page, read the docs.
 
I have been prefixing it with au in what I wrote above
 
@anky_91 might also be worth timing against functools.accumulate
 
@AnttiHaapala export.arxiv.org/api/query?search_query=au:"J. Nygård" again returns a bunch of things with only J. export.arxiv.org/api/…; returns nothing.
 
5:45 PM
yes, right :) I will have to test it, thought it should be more effective over np.vectorize() if anyone had any prior experience
 
though...
@user129412 the api seems to indeed have been unaccented, so you must search J Nygard :(
 
But then I don't find those where they put an accent in his name, sadly, like arxiv.org/abs/1911.04512
I'll get in touch with them
 
hmm there is something fishy going on with the api parser.
 
Sunday almost done here.. rbrb goodnight guys :)
 
6:08 PM
@anky_91 well it can hardly be slower, plus you get a ufunc
 
6:32 PM
are it's possible to generate `JSESSIONID` using `UUID`, something like
JSESSIONID=7DC056E793F1CE6922298668E4889DBB
 
Is f'JSESSIONID={UUID}' a valid answer?
 
let me check.
 
I suspect we're missing some information here
 
i tried with uuid 1,3, 4 and 5
 
cbg
 
6:39 PM
cbg
@AndrasDeak well, I meant the shape itself. not about inserting it inside format-string.
 
im writing a recursive quadtree generator, and im having trouble getting it to work, so i thought i might ask here before oosting on main stackoverflow
 
@αԋɱҽԃαмєяιcαη Why do you need to generate one of those?
 
dpaste.com/16RAHV9 Heres my code, would anyone have any idea as to why im getting really strange results
 
As far as I can tell, a JSESSIONID is something a java server sends to a client to identify them. Are you writing a server? In Java?
 
@Aran-Fey that's correct. and i need to generate the UUID for multiple connection.
 
6:43 PM
@3141 do you have a reference implementation or a description of the algorithm?
 
nope Im afraid
 
Doesn't whichever server framework you're using provide you with that functionality of identifying users? You really have to implement that yourself?
 
I thought a quadtree would be pretty intuitive to implement intuitively
 
@3141 okay. Probably not your issue, but I dislike the >/< dichotomy. If you have > for one part you should probably use <= for the complement. Even better: use logical indices for the former and negate them for the latter.
 
Hibernate framework
 
6:46 PM
noted, ill make sure to change it
 
I've never seen quadtrees from up close so I won't be able to help debug (others might)
 
ok, thanks for your time either way :)
 
You're supposed to have small boxes around dots and larger boxes around emptiness, right?
 
yup
every dot should be contained in its own box
 
okay
@3141 and correct or not, you should check whether it'll be faster if quad_list is a list, not an array, and use .append rather than np.append. And only convert to an array once quadtree has run its course (if at all necessary). I suspect using a list would perform much better.
 
6:54 PM
ah ok
ill do that now while im waiting
 
The explanation is that new numpy arrays occupy a fixed size of contiguous memory, and np.append will actually allocate a new array each time. This usually wastes a lot of memory which also takes more time, so you're almost always better off using a list as a snowball and allocating a single large array at the end
 
huh ok
For some reason i always thought arrays were faster
thanks for that
 
Once you have an array and you can use vectorized methods they are. And they use less memory than an equivalent list or tuple except for very small cases. But there's no free lunch.
 
I see.
 
7:14 PM
@αԋɱҽԃαмєяιcαη That, too, is a java thing. Are you in the wrong chatroom?
 
 
2 hours later…
9:14 PM
you know you're dealing with an old version of extjs (think it's now called sencha?) when you have to have make what should be PUT requests using POST but including {'_method: 'PUT'} in the data sent... good times
 
my concern today is that I've been writing "lambda" a lot more than things in Hungarian, so when I see (and write) "labda" (the word for "ball") I can't stop thinking it's spelled wrong
 
picked up an interesting script today
it's got import urllib.parse in it - which is fair enough
and then it uses that in a few places
then one random bit tries from cgi import parse_qsl... shrugs
gotta run for a bit but will be back early in the morning
rbrb for now peeps
 
rbrb, puppy
 
 
1 hour later…
10:33 PM
Pet peeve of the day: Websites that warn you about phishing on their login page, but don't have working "remember me" functionality
 
How about "firefox installs itself in Hungarian if you click the link in the automatically-Hungarian-by-IP google hit"?
I couldn't find the preferences, and when I visited about:preferences I realized that changing languages is not an option
serves me right for trying to change firefoxes before ditching google for duckduckgo
 
10:58 PM
and after installing a language pack you end up with a half-english-half-what-you-had-before firefox
 
I didn't even try, I nuked it out of orbit to be sure
 
that's what we get for installing stuff the old fashioned google-download-install way
package managers ftw
 
$ apt-cache search firefox |grep -i dev
libhtmlcxx-dev - simple HTML/CSS1 parser library for C++ (development)
mozilla-devscripts - Development scripts used by Mozilla's addons packages
libmozjs-52-dev - SpiderMonkey JavaScript library - development headers
libmozjs-60-dev - SpiderMonkey JavaScript library - development headers
No dev edition :(
 
what was the advantage of using the dev version again?
 
More sparkly :P Back when I switched to it it had multithreading and things like about:performance which the vanilla version didn't have. I haven't looked back because it works like a charm.
 
11:04 PM
TIL about about:performance. Now I'm wondering why the heck my biggest tab is my gmail inbox, with no less than 150MB
 
It's not terribly reliable in my experience. I tend to see that imgur pages start eating up CPU occasionally, yet they usually don't show up as major resource hogs
 
11:30 PM
I really need to find an antivirus that isn't worse than regular adware...
 
How about Windows Security?
Or do you not use Windows?
 
my 2 problems with that are that 1) my windows isn't activated (so no updates) and 2) I don't really trust it to be good at its job
 
The best way to prevent your computer from getting malware is get a computer that has no communication abilities of any kind
 
on a scale of 1 to 10, how irresponsible is it to use Windoze without an antivirus? (Except for an outdated version of the builtin Win10 defender)
 
Well, it's better than nothing
 
11:41 PM
Hmm, actually the malware signatures seem to update despite my missing license
I should probably just boot a real linux instead of this makeshift linux
 
@Aran-Fey Depends on how internet savvy you are. People like my dad shouldn't be using a computer without one, people like me learnt in their tweens about how to stay safe on the internets.
 
I mostly stay away from shady torrent/download sites nowadays. Caught an adware from those once, despite having a proper antivirus
 
it's not the site, it's the upload
trusted users on a high-profile torrent site are safe, or so I've heard
 
The site itself can have a lot of pop ups and stuff like that.
 
11:57 PM
firefox blocks popups usually ;)
@Aran-Fey does regular firefox have "take a screenshot" in built-in context menu?
 
yup
 

« first day (3347 days earlier)      last day (1590 days later) »