« first day (3423 days earlier)      last day (1511 days later) » 

4:27 AM
Could anyone help me with this?
https://stackoverflow.com/questions/60461951/cant-print-items-in-csv
 
5:26 AM
Hi, I'm stuck with web scraping. Anyone can help?
 
5:53 AM
@jason I might be able to, send me a link to your question
 
I am trying to find a solution for this but not successful.
 
@jason I'll take a look at it now
 
thanks @Philip
 
6:14 AM
@Philip any more details needed?
 
7:08 AM
@Jason, sorry Im having a child related emergency here, but I will get back to when I can.
 
No issues @Philip thanks
 
7:54 AM
@Philip would you mind looking at https://stackoverflow.com/questions/60463071/pandas-empty-data-due-to-no-columns-to-parse
when you have a second
 
8:05 AM
@stack Hey, your problem was that you were dealing with an iframe (results were shown inside an iframe within your page). So, just switching to the iframe resolved all the pains -
>>> driver.switch_to.frame("rus-results")
>>> items = driver.find_elements_by_xpath('//*[@id="content"]/div/div/dl[3]/dd[1]/a')
>>> items
[<selenium.webdriver.remote.webelement.WebElement (session="77237ca775f019d949493ee287dbeb4c", element="87a5c6bb-6541-4b8e-9827-92e572ee3019")>]
>>> for item in items:
...     print(item.text)
...
tmb200@rutgers.edu
 
@Peilonrayz I found two:
class A: x = 'not a method'
class B(A): pass
print(my_super(B, B()).x)  # should return 'not a method'

class Meta(type): x = lambda _: 5
class Class(metaclass=Meta): pass
class Child(Class): pass
print(my_super(Child, Child()).x)  # should throw AttributeError
For the first one, you may want to look into descriptors
 
@Gmanc2 please stop posting more recent questions. The room rules (available top right of the screen) state that a question should be more than 48 hours old before posting here. We now have 2 from you violating this rule
 
@ParitoshSingh Now I see what you were talking about... someone asked "Why can't I del self?" and the only answer they got was "try self.__del__() instead" :I
 
@superv Your code seems fine IMO, hard to tell what exactly is the issue unless I could reproduce it on my end. Anyway, did you try installing debug toolbar? It will help you with what was posted & what is the context of the loaded page, etc. So this would help you debug the existing issue with ease.
 
8:27 AM
Looks like our friend Gmanc here has been asking for help on the python discord for the last five hours, holy cow
 
8:42 AM
Perseverance is key
 
9:38 AM
@Gmanc2 @Jason please don't ask for help here with your fresh questions as per the rules
 
9:49 AM
Sorry @AndrasDeak
 
It's alright
 
10:06 AM
@Aran-Fey Thanks! I'll go look into fixing them :D
 
 
3 hours later…
12:50 PM
I have checked this documentation regarding heapq but I couldn't find how to initialize heap key, i.e. the parameter over which the structure of the heap is establihsed, or in other words the paramter of priority.
Question is how to do that?
On internet, they have given example of usages by taking a list consisting of integer, which is not helpful at all when one want to create heap consisting of some objects.
I guess I have asked something relevant to this here.
I guess I have to read about __lt__ and __cmp__. Thanks.
 
1:13 PM
I am stuck again, how to modify the behaviour of heappush() from heapq such that, If some element is already in heap then compare the element in the heap with the element which is supposed to be pushed in the heap, and if the element which is in the heap should be popped out, the element which was supposed to be pushed in gets pushed in.
Basically this:
Sorry, ctrl + k is not workng.
 
1:33 PM
@AjayMishra use a tuple of items as (priority, item) docs.python.org/3/library/heapq.html#basic-examples
Also watch for python 2 docs
 
@AjayMishra I think you can just change the append and remove to use the heapq alturnates
 
Should I spend $80 on Sublime Text 3? I'm using Notepad and I'm fine with it
 
No
If you're fine with notepad you shouldn't pay for anything
 
@JossieCalderon Have you thought about trying some free editors before spending money? Say PyCharm Community or VS Code
 
2:02 PM
im sturggling to understanding backtracking but im not sure why
why do we have this line path.remove(path[-1])?
 
Here's what's bugging me
# For 2, 2 text clearance upon click
def clickerase(event):
    # Could be fixed; if same text is typed, it's erased upon click.
    if e.get() == "Talk to me, girl.":
        e.delete(0, END)
An entry widget in Tk holds default text which is erased upon click. If you type the same text though, it will still erase it upon click.
How can we set an event so that we can only erase it once, upon only the first click?
 
2:50 PM
@Permian I don't think this is related too backtracking. Instead, it's a convoluted (and possibly broken) way of passing nums[i] in the recursive step.
Basically, path.append(nums[i]) means path[-1] is nums[i]. path is then passed in the recursive call, including the element just added. After the call, path.remove(path[-1]) removes the element of value path[-1], i.e. the one just added.
A problem is that list.remove works by value and removes the first match, so if there are duplicates it will pick the wrong one.
A better way would be to pass path + [num[i]] in the recursive call. This avoids mutating the input parameter, which can lead to surprising behaviours in recursive algorithms otherwise.
 
3:44 PM
It's also O(n) unlike path.pop(), is it not?
 
4:19 PM
@Code-Apprentice Thanks for the link, I will have a look. @shad0w_wa1k3r I have been using the debug tools. I will have a run of it again. Thanks
 
@AndrasDeak indeed, in the expected case list.remove will scan all n items until it finds that the last one matches.
 
4:37 PM
@AndrasDeak Its working is weird.
Seems to me that I have used it in a wrong way, instead of getting efficiency my code is running slower.
 
Are you using functions in the heapq namespace? heapq.heapify, heapq.heappush, heapq.heappop?
 
Yes. It seems to me heapify is useless, if I apply it to list, I am not able to apply other operation like heappush and heappop, as I get error reporting that r is not iterable.
where r is the list on which I have applied heapify
 
then yes, you are using it wrong
are you getting an error that NoneType object is not iterable?
 
Yes.
 
>>> import heapq
>>> lst = list(range(10))
>>> this_will_be_None = heapq.heapify(lst)
 
4:45 PM
why that would be none?
 
the error is clear enough: you can't iterate None, because it's not iterable. Your r is None because sopython.com/canon/118/…
 
like any standard function modifying its argument, the heapq functions don't return the list
 
heapq.heapify(lst) I tried this too <-
only that ^
 
what happened? what went wrong?
 
Nothing, but it is taking longer time to run.
 
4:50 PM
did you check the list after applying heapify on it?
 
what do you mean? It's type?
it is still list.
 
>>> lst = list(reversed(range(10)))
>>> heapq.heapify(lst)
>>> lst
[0, 1, 3, 2, 5, 4, 7, 9, 6, 8]
heapify will rearrange the items in the list
 
but it's slower
@AjayMishra coming back to your question, depending on what it's "slower" than, you're either using it wrong or not
although I wouldn't be surprised by the former
 
You can have a look on the code, if you want. I think I am breaking the contract by removing things from it.
 
5:06 PM
Contract?
 
I thought heap would only hold its property if the element aren't removed from it.
In the code, you can see I am removing element from the heap.
 
Yes, the answer to my earlier question is that you're not just using heapq functions. Since the heap is represented as a simple list there's no way for it to know that it should be a heap unless what you do to it stays a heap. Hence the heapq functions.
 
5:26 PM
@Aran-Fey aye, oh well. fwiw, there's more good advice than bad i suppose, so that's something.
 
I have a pandas df with two rows and 33 columns. I’m wanting to get desperate bar plots for each column. Each bar plot would have two bars representing the two data points. Can anyone help?
I’ve posted it on stack overflow as a question but the answers so far aren’t working.
 
When did you ask it?
 
Yesterday
 
We ask not to request help here for fresh questions on main.
You can try again tomorrow if you don't get an answer; weekends are slow. But the comments on your question seem reasonable.
 
Okay. I have tried the subplots technique but that doesn’t work for me as it’s separates the variables. But that’s fine I’ll wait. Thanks
 
5:31 PM
you can probably create subplots in advance and pass an ax keyword to df.plot in your loop, putting each plot in a different subplot
good luck until then :)
 
Thanks
P.s. to be honest I don’t think we even need the subplot approach as it’s basically just one plot for each.
*coloumn
 
wim
happy leap day, 6'ers!
 
@zahid Well, that's only something you can decide. Do you want to get a single axes or multiple ones? To be honest your question is also a bit unclear. It would help if you could clarify what kind of reasult you're looking for.
@wim something something jumping beans
@zahid also you can edit/delete messages for 2 minutes in chat
 
wim
@Dodge That's a really tough one because it requires a deep knowledge of the timezone model that Python uses, but it also requires some kind of niche geographical knowledge
the venn diagram on those two must be incredibly thin
 
@AndrasDeak on the actual question I’ve shown a screenshot from excel as to how the bar plot should look. It only a single axis.
 
5:43 PM
I just ignored the excel bit :P So it's still unclear: I see "two bars representing two data points", OK. But that's for a single column. For 33 columns you'd need to have 33 of those plots. So either 33 figures or 1 figure with 33 axes.
but let's leave it at that now, I also have to go
 
user11585758
6:07 PM
Hey guys how are you ?
Came with fascinating question? :)
 
user11585758
Guys ,
How can i change a fully connected vector to matrix? like for eg
i have matrix of shape (1, 4096) into some matrix (8, 8, 64)

Thankyou for kind suggestion
 
reshape?
 
With maybe transpose...depends on how your data is laid out
 
user11585758
6:24 PM
oh reshape, i had forgotten about it but..
 
@wim huh, so nothing to do with dst
 
user11585758
I had flatten the dataset like this (none, 8, 8, 64) to (none, 4096)
While reshaping does it reshape the same way it flatten
 
@mathematics yup
 
Canvas object has no attribute 'background'! But how can this be? It says in the docs at effbot.org that background is an option!
 
user11585758
oh , that means our data would return same as before flatten shape not wrangling the order of channels and matrices orders.
 
6:28 PM
background=
Canvas background color. Defaults to the standard widget background color. (the database name is background, the class is Background)
plz ? help ? me ?
 
user11585758
@JossieCalderon what about this is ?
 
2 mins ago, by Jossie Calderon
Canvas object has no attribute 'background'! But how can this be? It says in the docs at effbot.org that background is an option!
 
user11585758
oh i dont know what it is but i think

you are using canvas object and passed attribute 'background' which is not in canvas
 
@JossieCalderon is that not a kwarg in __init__ by any chance? And not an attribute?
 
@AndrasDeak Yes, it is.
 
6:35 PM
@JossieCalderon so there's your answer
 
So options don't get stored as attributes?
 
Only if __init__ explicitly does that
 
:(
y u do dis Tk?
 
If it controls something important odds are some other attr or method reflects it
 
Indeed...
 
6:38 PM
Like a .get_background() or something
 
I don't think it's possible to delete part of an object in a canvas on Tk.
But we can overwrite part of an object with the foreground, essentially erasing that part.
 
@AndrasDeak 33 figures.
 
@zahid I would just like to know how to get the background color-.-
 
@zahid so create a new figure before each plot...
@JossieCalderon different problem
 
@JossieCalderon background color?
@AndrasDeak yes I can do that but I was hoping to make it quicker by just running a for loop.
 
6:46 PM
@AndrasDeak I failed the X Y fallacy...
So, how do I get the background color of a canvas?
 
wim
@Dodge I did not say that ...
 
@zahid yes, do that in a loop
 
The answer is...
myCanvas["background"]
Was going to give $500 to the winner lol
 
well, looks like you just won $500 :)
 
@ParitoshSingh w00t
oh wait it's coming out of my own pocket. i just won 0 lol
Andras, this is really hard bro. I'm trying not to celebrate, but I just solved something I thought that wasn't previously possible. Wow.
I would ideally like to dab with everyone watching...
The answer:
def paint(event):
    python_green = "#476042"
    x1, y1 = ( event.x - 10), ( event.y - 10)
    x2, y2 = ( event.x + 10), ( event.y + 10)
    drawing.create_oval(x1, y1, x2, y2, fill = python_green)

def erasepaint(event):
    python_bg = drawing["background"]
    x1, y1 = ( event.x - 10), ( event.y - 10)
    x2, y2 = ( event.x + 10), ( event.y + 10)
    drawing.create_oval(x1, y1, x2, y2, fill = python_bg, outline = python_bg)
 
wim
6:53 PM
Riddle #22 clue: It is possible for a datetime instance to represent a time that doesn't actually exist in the real world (how?)
 
@JossieCalderon good job!
 
Thanks...cheers!
 
7:24 PM
Ok, now I need help lol. My listbox won't expand to fit the edges of my frame.
:(
 
8:18 PM
My listbox wont expand
pls help
I dont know how to make my own listbox contained in a frame expand
please help.
 
if you have/can prepare an MCVE and ask about it, perhaps someone can assist you
 
What's that? An MCVE?
 
minimal complete verifiable example. further read
 
8:37 PM
@JossieCalderon do you seriously think that posting the same request multiple times helps?
 
 
2 hours later…
10:59 PM
hey guys, I was curious if there were any similarity metrics that valued low correlation locally and higher correlation globally for a time series. Playing around with a stock example where you build an index fund and I want to construct a fund where assets that fluctuate locally are anti-correlated in the selection.
 
@AndrasDeak Do you know how I can resolve the error?
 
11:30 PM
@DarkRunner no, but I know that you should not ask for help here with fresh questions on main. It's also bad form to ping random people with your problem.
 
11:47 PM
@AndrasDeak What should I do if no one is looking at my question?
And if I can't find any other answer online that resolves my problem?
 
wait more than 30 minutes
especially on a weekend
 

« first day (3423 days earlier)      last day (1511 days later) »