« first day (3558 days earlier)      last day (1373 days later) » 

12:06 AM
@X4748-IR I think Google used to use recursive associations to store these relationships. No idea what they use currently
 
 
6 hours later…
6:20 AM
@shelby Hello. Please take note of the room rules specifically in regards to bringing questions into chat from the main site that are less than 48 hours old.
 
6:32 AM
@roganjosh I read the room rules, I will be following the room rules from now on!
Thank you
 
@shelby No worries, thank you :)
 
Can someone tell me why the checkbox never gives 1 even if it is ticked.
On the other hand, when I use root in place of root1, it works correctly. Seems like a problem of scope.
 
@Abhijeet.py Please see our formatting guide for posting code in chat
 
6:57 AM
Ok, here is a better option - The code is in this link dpaste.com/2X31TKW, the problem is commented in it.
 
is there a way to use round()
like
number = 0.6900000000000119

number = round(number,1 )
and round to the smaller part == 0.6 insted of 0.7 ?
 
Hello all,
 
@Amundsen probably something along this answer.
>>> Decimal(0.69).quantize(Decimal('0.1'), rounding='ROUND_DOWN')
Decimal('0.6')
it can be cast back to a float.
 
7:16 AM
Anyone facing 500 on github?
 
@Cleancode yup :/
 
@metatoaster thank you
 
7:35 AM
@Hassan please see the room rules particularly in regards to bringing new questions (less than 48hrs old) from the main site into chat
In addition, you've now double-posted that question on main now. That's not how SO works - please stick to a single question per issue. If the initial question doesn't get much feedback then you may need to work on improving the original
 
@roganjosh Thank you, I have deleted my old question and modified my last question
 
 
2 hours later…
9:16 AM
huh, requests is not a part of core python. Surprising, given how good it is.
 
9:27 AM
"being good" is a good reason not be part of the Python core.
The standard library is very sluggish to update.
 
that's the sad direction things are heading, as it seems.
 
It's an unavoidable result of being a standard library, and thus tied to the Python release cycle.
Much of the mess of typing comes from it being part of the standard library.
We wouldn't need typing_extensions otherwise, for example.
 
Closed
 
@MisterMiyagi @LinkBerest thank you for that suggestions, didnt know interviewers were in this room, wow
 
^ closed
 
10:25 AM
I'm just about to hammer a HNQ. I hope it doesn't upset anybody... stackoverflow.com/q/62864163/4014959
 
@PM2Ring excellent
 
I hate to be a party pooper, but hey, the answerer has had a nice couple of days from a question that ought to have been closed, not answered.
 
Sunday --> 800 people see that question and only 1 person VTC'd on the most-active tag. Indeed, it had its run :)
 
@roganjosh FWIW I saw it at 4 upvotes but it didn't seem easy enough to find a dupe for so I just ignored it
 
I never spotted it but it seems you're not alone there since I see some big names have commented but didn't vote/hammer
I'm not sure when I last followed an SO HNQ actually... I seem to be following the weirder ones these days :P
 
10:37 AM
A day or so ago on Physics.SE, we got a question about LAMMPS, an Open Source material modeling program supported by the US govt Sandia Lab. The question was rubbish, but LAMMPS looks interesting. The latest version is written in C++, older versions were in Fortran. I'm mentioning it here because it comes with a bunch of enhancements written in Python.
@roganjosh Some of the HNQs from Worldbuilding can be fun, but sometimes the bad answers to questions with the hard-science tag make me want to punch people. ;)
 
That's what hard science is, right? Punching people?
 
It worked ok for Buzz Aldrin.
 
heh
 
Ha, setting precedent
Then again, my favourite scientist Tycho Brahe would just go with an all-out duel
 
Today, a Worldbuilding HNQ led me to some interesting reading about platinum. These days, it's a precious metal, but back in the 18th century it was a problem because it "contaminated" some South American gold ores, and also unscrupulous people would intentionally adulterate gold with it.
 
10:50 AM
hehe, nice
If only they knew that they could make gold with it!
 
The obvious solution is to declare platinum to be a precious metal. But that sort of thing upsets the balance of power.
 
@roganjosh weird, I was going to note how he's called de Brahe here, then I noticed this note on wikipedia
 
I've seen several spellings when I was reading around his incredible eccentricities. Thankfully it seems I picked the one he adopted himself in this case :)
 
An HSM HNQ reminded me of another awesome scientist, Émilie du Châtelet. Sadly, she died at the age of 42, due to complications in childbirth.
 
11:11 AM
@roganjosh Had a look at that code is that just for your portfolio? also why do you use the core folder in alot of places? whats the use of that in flask
 
@Kwsswart I wouldn't say that I use it commonly really?
The name has no real significance, but it will house any models that are used cross-site as opposed to a single blueprint
 
@roganjosh I see helps separate the layout template for example or sub-templates
You using an api for the map?
 
And yes, it's just for my portfolio and currently only covers vehicle routing. I'm actively working on refactoring the other parts. I want to push the second version live ASAP but I'm not happy with my rushed effort on the one that's currently live so it's a lot more work than I anticipated
 
I think going to go through it and read more in detail when done with the flask tutorial to learn to understand code better
@roganjosh Fair enough always room to improve no?
 
The worst code is the code you wrote 6 months ago :P
@Kwsswart 3. I run my own OSRM server, my Jsprit server, which isn't included in the github (I'm still debating whether I will include the production solver) and a Mapbox API to load the map tiles because I strongly dislike the design of OpenStreetMap tiles
 
11:21 AM
@roganjosh Nice man not sure what a JKsprit server is
 
That's what's actually solving the vehicle routing problem
 
@roganjosh Oh so its a separate server that the only I was looking at communicates with and receives the info displayed when clicking solve button from
the one*
 
Yeah, it's dispatched off to something you can't see, which then mysteriously answers. The problem with both solvers (Jsprit and my custom one for production) is that they are so badly ripped out of the context they were actually supposed to work in, the API is... cumbersome at best
 
interesting whats the benefits of separating them
 
11:37 AM
Apart from the fact that jsprit is written in Java? :P It's jerry-rigged because the actual system had a huge middleware component that I'm just bypassing in that particular example, which would normally be keeping track of live developments (people rescheduling deliveries, or completed deliveries etc.)
 
11:52 AM
@roganjosh do you utilize java as well as python? I was wondering which to learn and this seemed the easier to learn at first and get into work with and then after learn Java
 
For this particular case, I had no choice but to learn some Java. I had 3 months to go from never-having-programmed to getting a system up and running for a start-up before they went for another funding round. I don't use it outside of jsprit and, actually, I'm starting to re-write (and, hopefully, improve on) jsprit in python/numpy but that's a goal that'll take a long time
 
@roganjosh Fair enough did you start doing freelance or studied
 
When?
You already have the site that gives my history :) I have never formally studied programming, I just taught myself as I go. I freelance currently. Anyway, the link to the github was more so you can see the form validation + ajax updating of the front-end
 
12:17 PM
@roganjosh Yeah I am gno look into it closely once I have finished the tutorial so I can understand it better, I am keen to see the way you write the validation, Have book marked it so if you update before i finish i can will have it
You validate on that server no not on the other server?
 
It's validated in flask. It should be impossible for anyone to submit a legitimate form that doesn't pass those checks so I automatically assume that they're tampering with the HTML and just reject it
 
12:48 PM
Ahh I see
 
1:37 PM
yo guys I need some advice. In my flask website, after user fills in the form and submits, he gets to a page where I want to serve him the result of his consultation. I can do this by serving him a dictionary the code creates, but it has a lot of child nodes and is very big. First I tried to import pprint into html file using jinja stuff, but I wasn't able to figure it out.
But now I'm wondering if there is a better method to display trees. (When you click a node, it shows childs, when you click again, it hides them) Couldn't find it on google because I lack the proper words for it, probably. Any ideas?
 
What are "child nodes" and how deep does it go?
It'd be helpful if you gave me some context
 
displaying a bunch of curly braces and colons and quotes to the user would be awful UX. You probably want something like a treeview
 
@Aran-Fey I ended up having to do this with our FastField implementation. I give it my best shot at parsing the JSON but there's no consistency in field names or the data it provides. My parser does its best but I provide a link for "lol, here's a modal containing the raw data cos I give up". Am I a terrible person? :P
 
I tend to use D3.js to do that (if you mean a dynamic, drill-down type display) but there are a lot of ways to do that (all involve js if it has to be dynamic - certainly can do a static but feels dynamic version without it though)
@roganjosh JSON is a lie!
cause nobody actually follows the specifications with large datasets (same with CSVs & XML & .... ) ;)
 
@LinkBerest jsonmas ruined :'(
 
1:53 PM
@roganjosh I'm gonna go ahead and say... hmm... let me think... no
 
I've used jstree.com a couple of times - fairly easy to use
 
I actually like json as a data structure (its just a dict/map really) but yeah, its the second worse text I have to parse (because I expect it to work and people just break it's rules randomly and at random times). Number 1 will always be pdfs of images with tables
the tables man, they haunt me. table images don't parse
 
I found a big bug in my app so I'll have to fix it before anything else lol, and I can't get how the tree really looks like, but each node looks more or less like this: pastebin.com/5MAp3Tsq but a little deeper (2 or 3 nodes down)
oohhh so I'll need js for this, I was missing this part. Thanks fellas will take a look at it!
 
@Aran-Fey Very reassuring :) Don't forget that us Brits are quite self-deprecating :)
 
@roganjosh as you should be
:P
 
1:58 PM
Oh, here he is! :P
 
@PedroSpinola if you want it to be dynamic, yes. You can make a non-js version where clicking displays a server-side template that varies based on the data (but keeps a predictable structure) - either way is a bit of a pain.
^ if you don't understand what I meant by the second way - then yes, use JS because you don't want to jump down the other rabbit hole blind
 
@PedroSpinola As Jon & others said, you want something running in the users' browser that can dynamically display tree data. However, I have some Python code that can be helpful for traversing & exploring data in nested dicts & lists. It's not intended to create pretty output to show users, but it may be helpful for you during development.
Apr 21 at 12:59, by PM 2Ring
@JoshuaVarghese You could search for the string "'Image'" in str(x), but that's still a bit fragile, since it relies on the desired string being single-quoted. If you want to know a robust way to do these things see my answers https://stackoverflow.com/a/47075972/4014959 & https://stackoverflow.com/a/52414034/4014959 Those are for stuff coming from JSON, but it should work on the OP's data, since it looks like it came from JSON.
 
^ and that's the start of the second one (figures PM2 would have said this somewhere about this ;)
 
Before starting this whole project I really thought it could be made in a week or so. What a mistake lol :P
Yeah I understand I could make it with a special jinja template, if I'm not wrong.
 
FWIW I looked into quite a lot of JS implementations for this kind of thing (factory building --> department --> machine --> machine component --> and-so-on) and they were pretty crap.
 
2:02 PM
Will take a look at those @PM2Ring, I appreciate :)
I just don't get why it's not easier to do some stuff that has been done before millions of times. Gives me memories of the first time I tried to make a website in 99 lol
 
To the point that I think you'd probably want to roll your own in-house. Or you configure your frontend and server to give individual levels. The tree views were... not good
 
There are a million different wheels in the wheel shop. But none of them are completely satisfactory for the user. So you end up re-inventing the wheel.
 
@roganjosh so a longer way of what I said earlier ("I built my own using D3.js")? ;) :)
 
@PM2Ring but this should change with the advent of machine learning and similar techs in the next few decades, I believe
 
@LinkBerest I'm probably agreeing, if only I could get round to D3 :P
 
2:07 PM
damn @roganjosh you getting me scared lmao
 
It's helpful but meh still problems
You'll probably get around to it when it becomes D4 ;)
 
<pencils in to diary>
 
is there an easy way to pprint my dictionary instead guys? I think I'll be going with that until full development of the algorithm is over
 
@PedroSpinola heh, that was the second option - its horrible for some types of treeviews and helpful for others. No answer is the answer in this case
 
@PedroSpinola It's not to scare you, but this is not a simple thing
 
2:10 PM
....now where did my machine learning is not magic but just a way to say using math quote go?
 
yeah I know @roganjosh :P I'm mostly scared of how long it would take, not the complexity or difficulty
 
Jul 9 at 17:18, by LinkBerest
Jun 8 '16 at 2:24, by JGreenwell
words I said to someone this week: "Machine learning, yes I'm using that term instead of Artificial Intelligence to make a point, is not magical nor does it truly reflect the thinking methods of humans. It is instead more of a form of math and logic which helps machines recognized patterns."
 
@PedroSpinola Can I just rewind us to my initial question about the context of this problem please?
 
@roganjosh what kind of coontext you mean exactly, pardon me?
 
anyway this is getting way deeper into this problem then you need to be (though it does show how deep this problem is - it is definitely one of the "not solved, well, yet" in any language problems)
 
2:11 PM
@PedroSpinola I want to know the practical problem that you're trying to solve
 
@PedroSpinola pprint isn't really intended for user output either. It's for the developer, and it's only marginally better than plain print, and sometimes it makes things look worse, because it's not very "smart".
 
I need dict output to be printed in a readable manner into html page so me and my partner can test the algorithm (he is not very technical and can't use command line etc) and finish developing it. That's all for now, I believe. I thought I'd create a structure to visualize the dict, but it's not necessary for the moment, particularly considering how time-taking it seems to be.
 
@PedroSpinola Have a look at the links I posted earlier, and the links in those answers to a couple of my other answers. There's essentially a mini-tutorial in there on traversing nested dicts & lists using recursive generators. Once you work through that stuff, you'll be able to use / adapt my code to extract & display your data in a way that's more user-friendly than just using json.dump
 
I understand @PM2Ring, but for now it would suffice to have a dev version.
 
So, it's not really a UX problem. Just dump the JSON to the page if that's what he needs
 
2:17 PM
Oh maybe json.dump is a good iidea! Will take a loook at it
yeah
good one!
It will be a ux problem, but only in the future. We got time constraints, and what I'm doing with algorithm is way harder than what needs to be doone with css+js on websiite
 
@PedroSpinola Ah. We kinda assumed you would already be familiar with json.dump & json.dumps :)
 
oh, and related to an earlier statement: I don't know flask (only at a basic level at least). I build my stuff then give it to the webdevs and say "have fun!" ...... they kinda hate me for this but they also cannot build what I build so here we are >;)
 
I've read about json, but since I was able to transfer data from websiite to server with request.form from flask, and send it back on render_template as a python dictonary, I thought I wouldn't need it :P
I hate webdev man
 
@PedroSpinola Right. And it's an excellent design strategy to have a clean separation between how your data is processed and how it's displayed. If you lump that stuff together it's a major PITA if you want to make cosmetic changes to how the data is displayed.
 
@PedroSpinola just send the json back as a response
I'm not sure I understand your work setup. I don't know what your colleague's position is, if they can't review the data in any other way. At some point, they will need to review the data outside of the response that's sent back to the browser. In the short-term, you can do this
 
2:24 PM
@LinkBerest I'm not a scientist nor do I have deep knowledge of machine learning, AI, etc.. But from what I understand and the way I see it at a macro level we don't need magic. We just need maths and good algorithms to create stuff like a programming language/something in that line that can correct simple mistakes, or build code by conversational methods...
AI is very good at recognizing patterns, but yet most of it's use is stupid corporate big data on advertisement or something correlated or natural sciences, for the moment, for what I know
@roganjosh yeah, we're going step by step on this. but in the future I'll have to organize not only this dataflow/control, but also how it's displayed to actual user, and how they can store this consultations/report.
 
What's your database?
 
@PedroSpinola yep, I've used that and similar statements to help beginning students remove the preconceptions these types of ads from their minds then slowly begin reintroducing starting with the logic, then the math, then bringing those together with code & real examples. (found if you don't remove this preconception its extremely difficult to teach)
 
@roganjosh mysql
 
basic answer is: we are using ML/AI to approach this. We are far from an answer (doesn't mean we won't find one just its not soon for certain definitions of soon)
/me puts up shield against josh's rant against mysql
;)
 
@PedroSpinola In which case, I think you should be fine storing the problem in the DB as JSON and you can write a small script for your colleague to extract it and pprint it
@LinkBerest Josh is calm and collected; what you on about? :P
 
2:29 PM
oh, nothing (postgres forever!) (also meeting time - adios all)
 
Have fun :)
 
I don't know what you mean @roganjosh, at all tbh.
 
@PedroSpinola You can develop your front end in response to the response of your server... You can also store the raw response (which you say is JSON) in that DB too
 
@LinkBerest As you know, far or soon is a very relative concept. Particularly when you're talking to a philosopher who has time and social/scientific/thought development as one of his primary concerns :P
 
So, you can develop your site, and your colleague can still get at the raw data of each request without pprinting it to the browser
 
2:33 PM
ohhh I get it the part about storing db in json
but what you mean with a simple script so my partner can see the print?
by looking straiight at db?
I see!
 
No. By extracting by some identifier (whether that's the row ID or some other ID) and transforming it into some pprinted output for them
 
good idea man!
yeah
 
:)
 
he's gonna read it in mysql workbench LMAO
I don't know if you ever read or thought about something like this deeply @LinkBerest, and it's hard to talk about stuff like this in english because I cannot be exact with words, like I do in my native language, and which is essential to rigorous thought, but science development is analog to culture, economic and political develoment. This is to say science development is not a direct product of scientific efforts as a distinct part of society.
To make an example, you can look at how science fast, deeply, and in analog pattern in all fields (and therefore as a whole) developed after the end of 18th century (french and american revolution, end of slavery, etc)
Also, there's a widespread recognizable pattern in scientific thought you can see throught history where current thought always thinks it's definitive. In the same manner european scientists were 99,9% convinced spontaneous generation was a reality, social thinkers were convinced before the 18th slavery was eternal, only because it had been the rule for maybe 80 or 90k years before.
 
2:48 PM
In any case, I'm not sure quite what point you're making so it's perhaps best to leave it
 
 
1 hour later…
 
3 hours later…
6:41 PM
I feel a bit bad for this OP who posted a syntactically correct complete program, but got closed as "needs MCVE" because it uses random and only crashes 1 in 9 times
How version-intercompatible is random.seed? If OP found a seed that consistently produced the crash, could he expect it to also crash on all the readers' machines?
 
@Kevin it's probably safe with version=1
at least that's what its description seems to suggest
 
Hmm, could be
 
Ah, more relevant: Notes on Reproducibility
 
Once again I am bothered by a lack of distinction in the docs between Python specification and a description of what CPython tends to do
It has never been a problem for me in a practical scenario and it probably never will be, but it's the principle of the thing
I need to know whether KPython is free to implement random.seed in whatever nonsense way it chooses
 
6:55 PM
Why does that remind me of Shaun of the Dead?
 
I'm surprised that's legal. Or, if it turns out it isn't, I'm surprised it's not illegal in an easily googleable way.
 
I like the bit about the insurance guy being concerned :)
sounds like a bit of a psycho landlord though... He said the fence worked because "people keep away from it, people are like sheep". and One person who did not see the funny side was Mr McFadden's insurance broker. "He was a bit worried but then that is what he is there for," he said. "He rang a nephew of mine and said 'I hope he is not electrocuting people'. "Well come and find out if I am."
 
I was going to say I was concerned about people that put their hand on the fence and find that they can't let go because electric shocks make your muscles contract, but the Internet tells me that electric fences usually deliver pulses of current in one second intervals, rather than continuous current, so I guess the victim has the opportunity to let go.
 
after a few pints... could end up as a new drinking game of "who can hold it the longest" or something :p
 
It's a double challenge of "hold on and hold it in" if shocks have a deleterious effect on bladder control
 
7:06 PM
Especially if it's one of those if you let go of the fence then you have down a pint or something...
 
If the fence delivers about as much voltage as an electroshock weapon, the high score will be about 3-5 seconds, at which point your legs will give out
 
@Kevin 1. It's probably harmless, 2. Proprietor seems to rely on it being a deterrent. It's probably off.
He doesn't say "of course it's turned on", he says "I dare you to see for yourself"
 
7:21 PM
If it's turned on, I'm leaning towards "mostly harmless", at least for physically healthy patrons
 
Yeah. It's not Jurassic Park. Stables and whatnot have such fences around, they just give a sharp sting to the victim.
I'm sure there might be edge cases with wet (inside and out) customers with pacemakers, but for the vast majority it should be harmless
 
A sign at the front door saying "beware the raptors" would be awesome though :p
 
@Kevin oh, the stable thing reminds me: such electric fences have two electrodes, so if you touch them the electricity isn't grounded through your legs
 
Gonna open up a competing bar whose employees fire nerf darts at people that get too close
@AndrasDeak I was wondering whether the current goes through your hand and arm and torso and legs, or if it just goes through your hand.
 
I happened to ask my sister-in-law the same thing two weeks ago (she regularly sees electric fences), and she said it also works if you are wearing insulating shoes
this can only mean that the current is closed through the fence itself
So I guess just like with cryptography, it's only safe if you don't roll your own
 
7:29 PM
Makes sense. I expect the average electric fence consumer demands a product that almost never kills trespassers, because nobody wants to go around their property perimeter once a week cleaning out the crispy squirrels that have built up
 
plus in Hungary you're not allowed to kill people
 
Me, an American: I understand each of these words individually, but in that order they don't make any sense. [I peer closer at the sentence with the magnification scope of my handgun]
 
Wow... California's going lockdown heavy again it seems
 
Perhaps you mean "you're allowed not to kill people", which is true in America too, except on Purge days
 
hehe
 
 
1 hour later…
8:44 PM
import worms

class Can(worms):
    def __init__(self):
        open(self)

monica = Can()
Can someone explain to me exactly what Monica did to get banned, or demoted, or kicked, or whatever happened to her? After a 3-year hiatus, I've only been back for maybe 6 months or so, which is why I ask. I dove down the rabbit hole of Meta, but couldn't find what her infraction(s) really was. I gather it has to do with the corporitization of Stack Exchange and moderators being encouraged/forced to act in ways that they didn't before, but beyond that I'm lost.
 
9:16 PM
@MattDMo "can of worms" doesn't even begin to cover it, and I'd rather we didn't discuss that here (this is mostly a note to others). Nobody knows exactly what happened (even bystander mods have different accounts of events), but the fundamental theme has to do with the dignity of transgender users and transphobia, tying in with the new Code of Conduct.
Try googling (duckduckgoing) her full name and find the first non-SE hit, and read that. The very existence of that (those) article(s) is part of why things blew up.
It also won't give you the full picture, same as the dozens of posts on MSO and MSE that contain her name.
Her blog is also linked from her profile so you can read her account of events
 
Hi, I 'm using the python embedded to deliver a project to a person so that he can run my python script which actually needing to install python. I installed the packages by uncommented "#import site" and the packages are installed. I can see the Lib folder having pandas, numpy etc.. and also the python python-3.8.0-embed-amd64 size is also 120mb
writing more just a sec
C:\Users\Dell\Desktop\masprojapp\python\python-3.8.0-embed-amd64\python.exe run.py 45 78 . When I run this command in command line python gives me error that it can't import pandas
I meant "without" in the first line
 
9:32 PM
you can edit messages for 2 minutes in chat
 
I cant see edit anymore
it only shows flag moderator
 
OK, then it's probably over 2 minutes. I just wasn't sure if you were aware.
 
I have this too bad habit of eating words or often thinking something and writing something else. Can't get away with it
 
@AndrasDeak I get the general idea, thanks. I'll go googling...
 
9:52 PM
 
@MattDMo also text as image, ugh
 
yeah, but it made it much easier to find the problem quickly, since you could see the code tab was untitled
 
Not sure how that error could come about, though. I guess it might be a sublime thing...
 
Yup, I've done the same thing before.
 
10:12 PM
here, is there a way to chain .str.startswith on a str column with .str.split?
here is my text so far df1.loc[df1["col1"].str.startswith("<a href", na=False)].str.split('/').str[-2].str.split('<').str[0] but i get "AttributeError: 'DataFrame' object has no attribute 'str'"
 
The specific error is because you can only use the .str accessor on a single column of a dataframe
sorry, I misread your code
<...>.str.split('/').str[-2] does not look right to me
Not sure what .str.split() does to your column, I presume it returns an object-type column with list-valued elements.
 
the code without the filter seems to get what i am looking for, i just need to find a way to filter it and apply to just the filtered rows. btw i just have 1 col in df
i am trying to get "ABC-471" from <a href="https://blah/blah/ACB-471" target="_blank">https://blah/blah/ACB-471</a>
i need to find way to apply filter since there are a few different scenarios, i only need to fix the ones that start with "<a href" for this scenerio
 
Well, I suggest you start going from dot to dot and see which step leads to the error. Even better: split out that long expression into separate ones, one on each line, and see where the error comes from.
 
hmm, that might be issue, my output has a numbered index col, looking for a way to remove it
breaking it down into the 2 steps, tried the first one df1[df1["col1"].str.startswith("<a href", na=False)] = df1["col1"].str.split('/').str[-2] got error "ValueError: shape mismatch: value array of shape (18,) could not be broadcast to indexing result of shape (18,1)"
 
10:31 PM
@msulol If you use backtick quotes ` around your code, it makes it much easier to read.
df1.loc[df1["col1"].str.startswith("<a href", na=False)].str.split('/').str[-2].str.split('<').str[0] for example
 
@MattDMo thanks will do
 
here is a full guide to code formatting in chat.
 
df1[df1["col1"].str.startswith("<a href", na=False)] = df1["col1"].str.split('/').str[-2] resulting in "ValueError: shape mismatch: value array of shape (18,) could not be broadcast to indexing result of shape (18,1)"
 
10:51 PM
weird enough if i put the search within col2, it works, df1["s1"]= df1.loc[df1["col1"].str.startswith("<a href", na=False)] and then df1["s1"]=df1["s1"].str.split('/').str[-2].str.split('<').str[0]
 
11:28 PM
hello friends, i am trying to merge multiple columns into 1. I have 4 columns. if a column's row is blank, i want loop to check the next columns. here is what i have so far. the new column seems to only return 1 of the 4 columns. rest are all blank
 
@msulol How to format code in chat: tinyurl.com/urnzp7k
@msulol "i want loop to check the next columns" Do you know how to write a for or while loop in Python?
 
@Code-Apprentice hi, i know the basics for if statements, i am not sure if issue with code above of if i need to find another way to deal with Null values
 
11:49 PM
After you enter your code, press Ctrl+K to format it.
 
1 hour ago, by MattDMo
here is a full guide to code formatting in chat.
did you read that guide?
you can't combine directed replies and code blocks, alas
 
@msulol if statements are not a loop. I suggest you learn about for loops in order to repeat some steps multiple times.
 
@AndrasDeak thanks, noted
@Code-Apprentice thanks, ill try to learn online for for loops. for the above task above would you recommend if statement or for loop?
 

« first day (3558 days earlier)      last day (1373 days later) »