« first day (3425 days earlier)      last day (1518 days later) » 

3:57 AM
hi
 
4:38 AM
^ hmm, on the sixth reread, I think I decoded the OP's issue...
^ actually it's ok and good, as per my edited version
Quoting Donna Summer: "She works hard for the money..."
 
 
2 hours later…
6:27 AM
@shad0w_wa1k3r Hey How did you find it as an iframe can you say me when I inspect I didnt identified
 
6:53 AM
Hey does anyone know how to get multiple subplots with matplotlib.pyplot, but of xgboost plot_tree() which is based on graphviz?
You can't do fix, axs = plt.subplots(5) then attach xgb.plot_tree(...) to axs[n]
 
7:17 AM
@stack This is how - i.stack.imgur.com/A5Gfb.png
 
should I stop engaging?
 
now that I'm here it doesn't matter ;)
 
cbg =)
 
cbg
 
7:20 AM
Ok Thankyou @AndrasDeak
 
cbg guys
 
7:45 AM
@Arne are you seriously going to explain every single program to that guy? :D
 
No, I'll turn it down a little
I thought it was fine because writing a program to learn about operator precedence is a little more complex, so "just try it" wouldn't have worked as an advice.
 
user10984358
maybe off topic and probably a design decision, but the reason for walrus having least precedence have to do with the fact it was implemented later? or its just it has to assign values for which it needs to evaluate it?
 
@Arne every question is "fine" in isolation. It's the volume and lack of improvement that's a problem
 
ok, I'll keep it in mind
@TheNamesAlc assignments usually have the lowest precedence, it's not just python
 
Thanks, I appreciate it :)
 
8:19 AM
@TheNamesAlc Order of implementation doesn't have anything to do with it. A lot of things have been implemented later and changed existing rules.
but compare for example to regular assignment, e.g. a, b = b, a, where the assignment happens with lowest precedence as well.
 
Not sure you can call that "precedence". In what other order could that statement possibly be executed?
 
@Aran-Fey C has comma operator and it does a, (b = b), a
 
python's assignments don't work like that, but ok I guess
 
@TheNamesAlc the walrus op should have the precedence where it needs least parentheses :P
all python ops are tpwards least parentheses.
 
incidentally, (a, b := b, a) is a thing in Python now.
 
8:53 AM
hi, how can i get a substring given the begnning and end points in a string : e.g.
string = 'https://www.reddit.com/r/subreddits/comments/activity=get_this_String/?someotherstuff'
start = 'activity='
end = '/'
 
regex can make this simple, and you can use a capturing group to extract the relevant information
 
You should definitely re.escape those variables though
in the general case
 
well if the substring is bound to be in there you could use native python...
 
yeah, i just added an r in there, is that enough?
oh no it isnt. oops
 
pretty stupid that python doesn't have a str.between method tbh
 
8:58 AM
>>> string[string.index(start) + len(start):].partition(end)[0]
'get_this_String'
 
out = re.search(fr"{re.escape(start)}(.*){re.escape(end)}", string) #yuck??
print(out.group(1))
 
9:33 AM
Is it the "blind leading the blind" day?
import urllib.parse

url = 'https://www.reddit.com/r/subreddits/comments/activity=get_this_String/?someotherstuff'
path = urllib.parse.urlparse(url).path

for i in path.split('/'):
    if i.startswith('activity='):
        print(i.replace('activity=', ''))
        break

else:
    print('Not found')
this is the solution :P
 
9:50 AM
Morning, I’ve been stuck in plotting bar plots using a for loop. My basic df consists of 33 columns and 2 rows. I basically want to plot the two data points as to bars in a bar plot. So I should have 33 plots at the end. I don’t need to use subplots as I only require one axis rather then two. Can help?
 
10:05 AM
@zahid perhaps a minimal dataframe example (3 cols instead of 33), + a handdrawn pic how it should be would help, after which you might actually throw them on the main site :P
 
I have uploaded it as a question on Stack overflow:
are you able to see it or shall I send u a link?
 
Are vue and django a good combination as front end and back-end for building web apps??
 
It has a screen shot I did in excel to show how it should look
 
10:19 AM
Morning. Would appreciate advice on doing multiple subplots with xgboost plot_tree() / graphviz (as above). Even something hacky in matplotlib. How can we cobble together subplots when those subplots were not generated by a native matplotlib function?
(Btw I just reported clone site oipapio.com for using SO content without attribution. oipapio.com/question-11028166 was stolen from stackoverflow.com/revisions/37340474/1)
 
10:49 AM
@zahid as I said above ^ perhaps a minimal dataframe example, that you will do in code, then you will have the code that does not work, and then in excel do draw a chart of how all plots should be drawn for that minimal example.
 
11:05 AM
@AnttiHaapala tools are for the weak
do you really need urlparse to split the string at /?
 
user11585758
Guys , I am really stuck for buying laptop for deep learning? Any ml engineer help me
 
user11585758
Should i buy i5 laptop with gpu or i7 laptop without gpu ?
 
@mathematics Please go read the threads on Kaggle, reddit etc. You'll get much better more timely advice. Also consider how many CPU and GPU cores each have, and how much cache memory.
Is this close-vote as simple error? Why is XGBRegressor prediction warning of feature mismatch?. User applied imputation to training-set but not test-set. The only thing that possibly might make this non-trivial is that xgboost's error messages aren't totally reliable. Opinions?
 
user11585758
oh thank you @smci i will ask there.
 
@mathematics You don't need to ask there, it's already been asked hundreds of times. Just read those threads where it was asked.
 
11:14 AM
@AnttiHaapala I have actually done this. ive posted it as a question on SO.
 
user11585758
ok :) . Thanks for helping
 
ive got this far
fig, axes = plt.subplots(nrows=1, ncols=df_new.shape[0])
fig.set_figheight(3)
fig.set_figwidth(9)

for i in df_new.shape[0]:
subset = df.iloc[i,:]
subset.plot(kind='bar', ax=axes[i])
axes[i].set_title(subset.name)
 
but the issue is its plotting only two plots with one plot showing all 33 columns for the first data point and the second showing all 33 columns for the second datapoint. I basically want 33 separate plots each showing the two datapoints contained within that column
 
cooling will also much better with a desktop
*be...
 
11:34 AM
Fresh cabbages everyone! Took a week a off, felt like a month!
 
11:45 AM
@CeliusStingher that can be interpreted as both good & bad ;) Fresh cabbage to you too!
 
12:06 PM
@shad0w_wa1k3r Indeed, but the good far outweighs the bad! Cheers :)
 
does anyone understand how that recurion/dfs/backtracking works?
i cant see how the second call to dfs works, nor why the last line is needed
 
can you ask who wrote it...?
 
i can try
 
It wouldn't be the first time that you brought here someone else's weird/confusing code. It's easier if you target the source.
 
ok
is backtracking meant to be difficult?
just seems so much harder than expected
 
12:15 PM
I implemented the eight-queens problem with backtracking once, and it was painful to me. But I also find it hard to parse recursive code, so I'm not a very representative person. Most regulars here will probably find it easier.
 
@Permian didn't you show that code yesterday already?
 
it probably also gets easier if you practice it
@MisterMiyagi that's a paddlin'
 
possibly im still looking at this question
 
yesterday, by Permian
http://dpaste.com/10WA3RA
yesterday, by MisterMiyagi
@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.
so when I just said "it wouldn't be the first time" I didn't realize it would be this literal :|
 
lol
 
12:18 PM
I mean asking again if you got no responses would be fine, but now you're asking the same people who responded the first time around
 
im sorry
 
might want to adjust your strategy
 
i did like 15 questions yesterday
 
Can anyone please answer for this If you know chat.stackoverflow.com/transcript/message/48732781#48732781
 
@AndrasDeak wax on, wax off
 
12:25 PM
@MisterMiyagi You mean by asking the same thing here over and over again Permian will build muscle memory to perform advanced asking tasks?
I guess that's only expected from you :P
 
I was hoping you'd improve your paddling skills to Olympic levels some day. :D
 
I should start doing it standing on one leg...
 
@stack They're likely going to interact over the same medium that any other web frameworks will. So they work as good together as {client web framework} and {server web framework}.
 
@stack Yes & no, but mostly yes. Reddit may be better at times, for such opinions IMO. e.g. reddit.com/r/django/comments/ancuh7/…
Very much dependent on your comfort levels in both.
 
1:09 PM
after getting used to that discord server, this chat room is pretty dang dead in comparison
though that's good for my productivity
 
@AndrasDeak yes!
 
What could go wrong if you don't use urlparse?
 
what wouldn't? :D
 
I guess if /activity= doesn't occur anywhere in the path you might accidentally extract it from the query parameters instead
 
1:34 PM
anything is possible.
even the urlparse in itself is provably b0rken
or it was unparse/unsplit
 
because it seemed to me that just replacing the urlparse line with path = url would work...
 
2:14 PM
cbg
 
 
2 hours later…
4:42 PM
Hello
 
hello
 
@Aran-Fey how are you? Do you think you can give me some guidance or advices on a code that I am working on?
 
I have 14 minutes before my attention is once again consumed by work-related things for the rest of the day, so everyone line up with your mcves now
 
I probably can, but depending on how much help you need I might not be up for it, seeing how I just got off work
Best avoid introductory questions and just post the problem you need help with
 
4:49 PM
KeyError: 'text' occurs when the dictionary you're trying to access does not have a key with the value 'text'
 
I'm guessing StreamListener and Stream are tweepy classes? You should try to post complete code
 
@Kevin How can I fix that
@Aran-Fey sure, let me edit the post
 
Perhaps you could check for the presence of the key before trying to access it, e.g. if "text" in d: data=raw_t['text']. Of course, you'll have to decide what should happen if "text" is not in d, and write the else: accordingly
 
don't include your auth information though
 
@Aran-Fey i just did it
 
4:53 PM
A cursory glance at the tweepy docs didn't give me any useful information about the on_data method, but I would be very surprised if it received json data as input
 
docs.tweepy.org/en/latest/streaming_how_to.html#summary says " The on_data method of a stream listener receives all messages and calls functions according to the message type" which leads me to believe that the method receives many kinds of messages, potentially with different schemas, some potentially having no "text" key
 
@Aran-Fey should I remove that part?
 
I don't know enough about tweepy to help you with this, sorry
 
It appears as though StreamListener has methods for more specific message types, for example on_status. I can't find any documentation on what other methods there are, but maybe there's one that triggers only for the kinds of messages that have text.
 
@Aran-Fey no problem, thank you for try it. I really appreciate it
@Kevin thank you Kevin.
@Kevin what do you think for the loop statement. why is it counting only Neutral statement ?
 
5:00 PM
Oops, meeting time, gotta go
 
@Kevin thank you Kevin
 
Heh... now probably wasn't the best time to get a bog standard cold... :)
 
5:15 PM
hope you get better soon, puppy :)
 
5:32 PM
Hello, i am learning python. Now i have script which i want to use on Django website. But transfering it is not working for me :( maybe there is someone who is good in Django and would like to help me?
 
it disappears into the void
 
@AndrasDeak thanks :)
 
@Aran-Fey please don't answer their random questions
although it's surprisingly fitting :P
 
sorry, realized too late
 
5:35 PM
it's alright, thanks
 
I HAVE ENCOUNTERED A PROBLEM D:
so i'm writing an integration test for a process that runs forever in a while loop
said process depends on python's signalling—but signalling can only be used in the main thread
that means that spinning up this process in a separate thread, doing run-forever, and checking if it's doing the right stuff is not possible—instead it has to be run in the main thread
but if it's run in the main thread, then there's no way to stop it from running
any ideas? what would you guys do?
 
knee jerk reaction: the process inside the loop can be treated as a function and tested without issues i'd assume. the fact that it has to keep running in a loop should have no bearing on the actual work being done
So, if it isn't prepared like a function yet, i'd change that and then test the logic of this function
disclaimer: I've never really written tests though.
 
the logic of the function's already tested (in a unit test)
 
Ah, i see
 
i'm writing an integration test now, though—that is, i'm testing to make sure that one process (that does some stuff & puts a message on the queue)
is correctly seen by this other process (the run-forever one that takes stuff from the queue)
and correctly does stuff w/ the message
 
5:46 PM
why can't the process be stopped if it's running in the main thread?
adding an exit condition shouldn't be too difficult, should it?
 
i'm testing via pytest, and if it's running in the main thread, then pytest will just "hang" (not really "hang", pytest will just never stop running)
so any commands i might otherwise enter to stop the process will be run after the process has started, which means never (since the process goes forever :D)
adding an exit condition shouldn't be difficult, no, but it seems weird to make that specific change just to accommodate a test (since there's no need for an exit condition outside of tests)
 
In my experience it's sometimes necessary to write code a little differently for the benefit of tests and/or other parts of your code
 
please check my issue
 
6:01 PM
@jacksonsmith please don't ask for help here with fresh questions on main as per our rules
 
ok
thanks
 
thanks
 
thanks
@Aran-Fey i try to avoid that almost obsessively (because i'm anal :D)
what i ended up doing was using the multiprocessing module instead of the threading module; process instead of thread
 
@AmagicalFishy as in Absolutely Negated And Limited ?
 
can i ask one question related to python
i am new in python
?
 
6:08 PM
@jacksonsmith sure :)
 
go ahead and ask
 
i index of excel col 1 and col A have only single field value like :
"operation: test. tes(23)
Day: 27 Feb 20"
can we convert it into dataframe so that i can access it any where in other dataframe loop
 
@CeliusStingher i am foiled by the lack of relevant, positive adjectives that begin with the the letter "N" and thus admit defeat
 
recbg
Anyone ever bump into an error where Windows isn't allowing python to write to a user directory eg Documents, Downloads, Pictures? Says it can't find the file specified...even though the part directory returns true with Path.exists.
 
@jacksonsmith no issues converting any excel into a dataframe. However, the 2nd half of your sentence worries me, iterally you shouldn't need to "iterate" through dataframes for anything. So i suppose to answer your question, yeah go for it, try reading your excel into a dataframe, and see what's what
 
6:21 PM
ya tried to read from second rows
its gives me fine result; but i have confusion in first index
 
6:37 PM
hey guys, i keep getting a regex related error with the pandas str.replace function
i did regex=False
but I get this error:
unbalanced parenthesis at position 63
 
@Skyler MCVE or at least traceback
 
also, that seems like a very good error message to be honest, so specific.
 
Please share the full code Skyler, I mean the str.replace line
 
also, mcve should clear everything up
 
might take a minute for an mcve, cant exactly share the csv that does the match
 
6:41 PM
indeed, take your time. I always like MCVE that don't rely on external csvs anyways, better for everyone.
 
the problem is that its some position 63 among a huge list of strings, so finding that string is a problem
 
Can't really have C in MCVE if there's an external csv
 
scratch that, i was just derping on the indexing, example line found so mcve inbound
 
But, the problem is not the csv as far as I know, but the pattern you are passing for str.replace or is that string very long?
 
its only moderately long, but I intentionally was trying to not use regex to not have to escape all the chars in the replace
with a list of phrases remove
i ran:
for i in remove:
  df_to_clean['Text'] = df_to_clean['Text'].str.replace(i, '',regex='False')
give me a sec to get a sample remove together
 
6:47 PM
yeah, don't worry, go finish your mcve first
 
remove=['test','dee','dur','xxx if applicable ( Value or xxx)- OPTIONAL):  ']
data = [['tom'], ['nick dee'], ['juli dur']]
df_to_clean = pd.DataFrame(data, columns = ['Text'])
df_to_clean
for i in remove:
  df_to_clean['Text'] = df_to_clean['Text'].str.replace(i, '',regex='False')
error: unbalanced parenthesis at position 43
I can see that theres an unbalanced paranthesis but I dont really care about that, more that this is a regex issue when I disabled regex
 
I solved my issue, apparently Windows Controlled Folder access was blocking python from doing anything in Documents etc.
 
yeah, adding the '/' before either ')' does indeed solve it but I can't think off the top of my head how to deal with it
 
@Skyler ah. it's funny i suppose my best guess, "False" != False. you never disabled it, and internally i bet it probably has a condition like if regex and "False" is Truthy :P
Which is pretty amusing honestly :D
 
dammit
im so stupid
 
7:01 PM
don't worry, we're all stupid from time to time. It's good for your sanity
i think. i can never be sure if that's wise or if that's my stupid talking.
 
I must be the sanest then ;)
 
heh, i might surprise you :P
 
@Skyler traceback would've helped. Just saying.
 
man. I feel old when I'm reading Python code with Typing in it....
Not use to the whole Typing syntax and what not
 
haven't had to deal with it yet personally.
we will burn that bridge when we get to it i suppose :P
 
7:43 PM
(sorry, I was at a pdb breakpoint in my terminal window...)
 
cabbage
@MooingRawr Typing doesn't make me feel old, but it certainly takes some getting used to. My lead is starting to use it frequently.
 
I feel old when I find some code that I wrote that has from Sets import set
 
8:02 PM
@Code-Apprentice I have read the documentation on inlinef ormset. As I understood, it can be use for multiple form on a page. What I want to do is like the SO survey, where the form is split on many templates and each form belongs to separate model. I have been able to do it will formwizard but I want to learn how to do it with fbv. What do you think?
 
I realized that there are things that makes me feel old.... and that in itself makes me feel.... old..... :\
 
8:24 PM
@superv What is fbv?
@superv Your understanding of formset is correct. It is used to represent and render a single HTML <form> from multiple Django Form subclasses in a single page. It sounds like this isn't quite what you want. I'm unfamiliar with formwizard. Is this from core Django? Or is it a third-party library? Also, I don't know what fbv is.
 
9:23 PM
@moo
oops didn't mean to send that
 
@EthanCulp You can edit or delete messages for a short amount of time after first posting.
 
9:38 PM
two minutes, to be specific
 
@AndrasDeak Thanks. I couldn't remember the exact amount.
 
9:55 PM
@Code-Apprentice Thanks, I will be sure to remember that next time
 
10:20 PM
Hi everyone!
Thanks for letting me in here! At last, I got evough reputation to be here.
 
10:35 PM
welcome =)
 
11:29 PM
hi :D
 

« first day (3425 days earlier)      last day (1518 days later) »