« first day (2793 days earlier)      last day (2159 days later) » 
02:00 - 19:0019:00 - 00:00

2:14 AM
cbg. Suggest we should make this canonical How to find the last occurrence of an item in a Python list. Do I wait for consensus before edditnt it>?
'editing it in'?
 
2:41 AM
It's been a while since I've done backend Python stuff
 
2:53 AM
lol
lol my friends clearly have no idea what my time is worth... one of them just forwarded me this craigslist
also they the person who created this ad is all set up to lose their shirt
(well at 10.00 an hour its not much of a shirt
 
Hi are you a dreamweaver programmer?
Mind if I steal that for Facebook groups?
 
@JoranBeasley RIP. Also. Dreamweaver programmer... is that really a thing?
Is dreamweaver still /used/?
 
lol
go for it
 
I told them i was not interested
(just fyi)
i just thought it was funny
but only in certain circles
 
3:05 AM
That's great lol
 
I explained to them that there was no such creature as a "Dreamweaver programmer" that "Dreamweaver" is just a fancy "text editor" and that they probably wanted a "PHP" Programmer ... but that a highschool intern would probably suffice
"extensive knowledge in coding" ALL OF IT!
 
and for 10.00/hr ... oh to be a fly on the wall for that interview
 
Yeah, you're not going to get much for basically minimum wage
At least nothing of great quality
 
meh to be fair its a non-profit ... so i think theyre hoping for someone passionate about their thing
and its not me... especially not to touch php
 
3:12 AM
@smci It looks ok to me.
 
Ah
Yeah
 
@PM2Ring Do you trust people's judgment to add stuff to canon, or do we wait for more consensus?
 
@smci It's customary to get a little feedback from room regulars. That also makes it more likely that people will remember that the new entry exists. ;) There's no rush, is there?
 
Sure, I'm just asking what the practice is. I'll wait a few days
 
I guess @wim should take a quick look, since it's his answer, in case he has further improvements for it.
Another thing we do with canonicals is to add comments to the other answers where appropriate. And in some cases we may cast delete votes on answers that are advocating really bad / dangerous practices, like using eval, but I didn't notice anything requiring such drastic action there.
When the room is active adding a canonical can happen pretty quickly, but it's pretty quiet this time of the week, and some regulars rarely appear on weekends.
@JoranBeasley Reading between the lines, it makes me sad to speculate what their previous webmaster was like...
 
3:50 AM
Gah I hate setting up a project stack/environment
 
@TristanWiley oh?
 
I'm starting a new project and I have no idea what to do for the backend lmao
I'm thinking Flask+React
 
Oh I forgot react was backend now
weird concept that
Frameworks annoy me tbh
 
React is backend now?
Wait what?
 
Well, predominantly annoy me
Well, it can be executed on the backend, @TristanWiley
 
3:53 AM
Ah
 
so, quasi-backend?
 
idk what I'm doing
There was a site that just build the boilerplate for you so you could start coding. Idk what it was
 
welcome to web dev
xD
 
Get out while you still can, mate
:P
 
3:55 AM
I've used Flask like once, so I really dunno lol
 
I've never used flask but it's just, not that pleasant as a career IMO. Obviously it is for some but
the ecosystem is such a mess right now
 
For work our backend is django and I kinda wanted to get away from it for a bit. But I could always use it
Idk what else there is other than Flask and Django tho
 
Ah this isn't for work? less painful
I mean. There's tons of options, especially if you're willing to use something other than python
what kind of website is it anyway?
 
I'm trying to use Python since I haven't worked with Python as much as I should've
Just some project idea I thought up of that I got excited about so now I'm gonna make it
 
You might only need simple templates and a Jekyll style "blog" (doesn't have to be a blog)
I mean, how complicated is the site itself?
 
3:59 AM
Fairly
I mean, depends on what we're basing it off of
 
Highly interactive pages?
 
Ah I see
 
So essentially what I'm planning on
A site where anyone can make their own webcomic. So they draw it or whatever, create an account, and their comics. Then we generate a site for them. So pretend Randall wasn't smart and we'll use xkcd as an example. He'd make an account and get

xkcd.webcomicthing.com. That'd be his own personal site, he could customize it (for starters just some colors, title, etc). Then upload comics, customize the alt text, and push.
 
Ah gotcha.
Neat
 
4:02 AM
Yeah
Then they get a percentage of ad revenue and we take the rest. So ideally they'd make a profit
and I could keep servers up without losing money
 
I see!
I've been meaning to make a portfolio website for some time, on a slightly unrelated note
 
Do it!
 
The trouble is that it's mostly kind of art for my own satisfaction (the site itself) so I've been waiting to find an aesthetic that I'm deeply happy with
 
Ah yeah
Do you have a whiteboard?
 
Also like, a gimmick to use with a similar kind of benine appeal to something like this: kevs3d.co.uk/dev/eglogo
 
4:06 AM
Ah you reminded me of a redesign for my site I was gonna do lol
Rip that
 
I think I have the gimmick to use for the "business card" page but I still need a good colourscheme and probably background level orf art for the main pages but, it'll probably stem from the gimmick (not the colours, mind you)
Oh? xD
 
Was sort of going to be an interactive whiteboard
idk, I'll probably still do it eventually
 
Ahhh
Also yeah I have a physical whiteboard, it's the only medium I can write on without pain or discomfort
 
Gotcha
Yeah, it helps being creative lol
I'm gonna scream
I can't decide. Django vs Flask
 
Also ip-tracker.org/locator/ip-lookup.php?ip=Gitlab.com RIP all those #movetogitlab folk xD
Well, choose whatever you're more curious about!
 
4:12 AM
People freaking out about that is kinda annoying lol
 
I mean. I'm nervous I'm not going to lie but.
 
Is it TRUE what the notion is about Python that I hear (or read) stated often with regard to it being better suited for scripting and not true programming and object oriented, etc.? Just curious if others here know if Python is just as robust or Java, C#, etc. or if it's really just more for scripting than programming? It has class, method, function, great with iterating, etc.
But I hear this notion often still so just curious if anyone can clarify why there's this perception unless maybe I just heard a few bad apples and most people don't think or say this?
 
@Cosmo Nothing to be nervous about. GitHub is going to be acting as it's own entity and honestly Microsoft cares a lot about open source.
Plus, now GitHub has the funding and leadership it was desperately looking for.
 
Oh it's not because github will become unusuable it's just, MS seems like it's trying to commercialise (read: embrace, extend, extinguish) Git as a whole. Github isn't the only move
 
I mean, GitHub is already a commercial product.
 
4:15 AM
Not github
Git
 
If anything, it'll become cheaper for everyday users under Microsoft
You can't really commercialize git
 
Git!=Github
But you can EEE open protocols and tools. It's what MS is known for
As for cares about open source, time will tell, I'm still not satisfied that they've made up for their past.
They do appear to be moving in the right direction so far, though
 
Yam @TristanWiley your avatar is about as distracting as any I've seen. And the way it varies in size is disconcerting!
 
Yabba Dabba Doo...........
 
4:19 AM
Like, they say they want to fast track commercial use of git or whatnot but, likely they really mean "we want to be primary, ideally the ONLY nexus point between big business and git through our Visual Studio Teams Services initiative."
 
@TristanWiley I don't know much about modern Web dev, but Django is more elaborate, and provides more stuff so you don't have to build that stuff yourself, but it can get in the way if you want to do things in a different way to the Django way. Flask is more lightweight, but it gives you more control over doing stuff your way.
 
@piRSquared you shouldn't go to room 15 then, we're almost all circles!
@PM2Ring Can you give me an example of something Django does for you?
 
It's not exactly selfless. I think it's foolish to ever assume company motives are philantropic.
 
@Cosmo I agree with that. However, sometimes motives can be aligned.
 
@piRSquared oh they certainly can. It's perfectly feasible to heavily commercialise git for business without damaging the rest of the ecosystem. I very much believe that open source and for-profit are not mutuallly exclusive, etc. I just don't yet trust them to make the right choices
 
4:24 AM
I share your mistrust. But I'm hopeful
 
I'm nervous because I'm on the fence.
 
@TristanWiley Sorry, I can't. I just know that it's a bit easier to get started with Django for a lot of common kinds of Web building tasks. But if you're doing something out of the ordinary you may find yourself fighting it. Also, because it's big, there's a lot to learn if you need to get into the details. OTOH, with Flask you're working at a more fundamental level, so it's easier to understand what it's doing.
 
Hm
Thanks :)
 
Initially I was angry because honestly I feel like MS gave up the right to forgiveness. But I'm not as angry anymore. I'm kind of the fence
 
Woke up to 300 replies from grumpy devs about GitHub. Guys this is 2018. Microsoft has one of the kindest, most inclusive CEO’s out there. You demanded they changed. They have. You demanded they embrace open source. They have. Now it’s your turn to change and forgive.
 
4:28 AM
This is what I struggle with. "Can I ever forgive Microsoft?"
 
I hate using windows
 
It's only been a year or 2 hasn't it?
I do too but, that's a slightly different issue, @NiNisanNijackle
 
So I realize I probably made a mistake asking in the Javascript room lol, but I hadn't heard this. Is it the case?
in JavaScript, 2 mins ago, by Jacob Schneider
never used either, but I heard that django's losing popularity and people are now moving away from python (except for google) for other frameworks.
 
I thought google used javascript already? @TristanWiley
 
4:30 AM
Depends on the tech area @TristanWiley
In web, NodeJS is king currently
 
@BitcoinMurderousManiac Python is one of the most object-oriented languages ever created. But its OOP stuff doesn't get in your face, and it doesn't require you to do a lot of tedious stuff that many other OOP languages like Java need. So Java types can get the impression that our OOP is somehow inferior, when it's actually better and sleeker.
 
@PM2Ring I mean, it's super subjective
I personally think that Java's approach to OOP is a stunted infant, but y'know
 
@PM2Ring That's like Red is better than blue.
 
^
 
@Cosmo where subjective is an attribute of the parent class.
 
4:34 AM
@piRSquared hahaha
 
Truck it, Flask it is
 
Hey, I don't know if any of you have the time, but could I get some help with Bs4 and have what I am getting pointed out wrong preferable rather than a fix? The list keeps returning empty even though I am trying to use a CSS selector to find the title of the items it brings up from the search.
 
@BitcoinMurderousManiac However, Python's type system does get criticized, and some of that criticism is valid. For small things it's fine, but for huge complex projects a more powerful type system can help prevent various kinds of coding blunders. That's partly where the "it's for scripts, not proper programs" comes from. OTOH, recent additions to the language address that to a degree.
 
I'm going to present python concepts to a bunch of people new to python on Monday. Any ideas or snippets of inspiring python to show that the inexperienced can appreciate?
 
Also, Python runs somewhat slower than Java, and quite a bit slower than fully-compiled languages like C ad C++. But the development and debugging time tends to be much quicker.
 
4:40 AM
Maybe try showing them something like having the machine learn how to predict who will win the super bowel based off wins and losses versus certain teams? I know something like that mainly has most of the code entering the strings into a list
 
@NiNisanNijackle I want to have series of talks. I plan on covering software life cycle, packaging, virtual environments, pandas and data munging, scipy/sklearn/keras/xgboost ML stuff. But I firmly disagree with the concept of jumping in to learn. It depends on the body of water you're jumping into. I can't cover all those concepts to complete newbs. They won't be able to see the forest for the trees. I must show what trees are first then move on to more complicated concepts.
When I get there, they'll be better prepared to appreciate the elegance
 
@piRSquared. How about having program that organizes all of your python files into a folder for you? Super simple with very low amount of lines.
 
So I'll be showing simple data structures and types, then move on to control flow. After that I'll cover classes, comprehensions, and generators. Then we'll see whose ready for more. Before the more part, I've got to show something they can do themselves...
@NiNisanNijackle I like it. File manipulation is good
I want to show a request/bs4 example too
 
@Cosmo Hey, this is the Python room. Of course I'm going to say pro-Python stuff. :) But it's not totally subjective. Everything in Python is an object, even our integers, we don't have any primitive types that aren't objects. Our functions are first-class objects. Python doesn't have all that verbose boilerplate that makes Java so verbose that it's almost insane to develop anything bigger in Java than "Hello, World" without an IDE.
 
Is it fair to say that Python is totally objective?
 
4:49 AM
Speaking of Bs4, could you help me out real quick? Just I am new to this web scraping thing and felt confused when looking online. It gets the title of items on a search and gets the price. @piRSquared
 
Python doesn't need getters and setters, but if you want them you can have them, and they're invisible to the caller, it just looks like you're doing simple attribute access.
 
I've literally run like one bs4 example before. I'd be figuring it out right now... that said. Go for it and lets see where we get to
 
@PM2Ring Well I mean, which is the better tool/model "overall" is subjective in that whilst you can objectively (to an extent) indicate why /particular/ tasks are suited to methods/languages, applying that to every task is, much harder.
And whilst I agree than python is better than java, that's largely because I find java to be painfully constrictive against my preffered design patterns
Which, the more I program, honestly, trends towards functional programming rather than strictly speaking OOP
 
I go back and forth between functional and oop. I tend to do what I think is prettier and which is prettier depends on the task.
 
4:54 AM
I also like cross-cutting concerns. I'm not super big on storing data and method as the same conceptual construct
 
@NiNisanNijackle what's the question?
 
I like OOP with Swift, it just looks nice
 
@piRSquared I think so. To be totally honest, it can work with primitive data types, via 3rd party modules, which is what Numpy does.
 
I like a lot of Rust's features, tbh. Including Traits but honestly. Rust's form of iterators is amazing
Java's Streams perpetually anger and dissappoint me xD
 
Good feedback!! I'm still a newb but somewhat advanced logic and scripting writer so Python so far seems pretty easy for me to learn and understand the concepts I've learned and written with thus far.
 
4:59 AM
@piRSquared I am trying to figure where in the thought process of what I am not understanding about the CSS selectors. I saw a class and I thought it would at least return something by doing the .select(), but it's not really doing what I am thinking it is. The thing showed up in a html class mixed with something that looks like this "<h2 data = "hey doug" max_rows = 0 class = "the_class_In_the_code">Hey doug</h2>". The thing is that everything before works until I try the CSS selector.
 
@Cosmo There are some functional programming features in Python, but the language design isn't optimized for them. That's due to intentional design decisions by Guido. Functional stuff can get hard to read, and it doesn't really make sense to mix paradigms. And one of Python's core principles is that there should be one best way to do stuff.
 
I entered the select method like this "soup.select('.the_class_In_the_code') which should at least return something in my thought process
 
I hear Python likes explicitness too. Be as explicit as possible with your logic with Python.
 
for t in shoppingList.select('.a-size-medium'):
    print(t)
works
 
@PM2Ring yep. I know. I use Python a lot as it was my first language. Lately I only really use it to write special/custom parsers/encoding translations, or as the coordinator between other applications written in distinct languages. Small-scale use cases.
Well, also Tensorflow
@BitcoinMurderousManiac it does and it doesn't. Type explicitness has, historically, been a sore point, there's new changes in the area now though
 
5:04 AM
Dough.... Sorry about that. Well at least I made that mistake when I am new to this. Thanks you!!!!
 
So this means always use the latest and greatest non Beta release?
 
Are you trying to perform a union of classes? like .a-size-medium OR .s-inline?
 
@BitcoinMurderousManiac that is a more complex question
 
I am simply just trying to get the title out of the thing which is in the same line of the class
 
@Cosmo I'm asking where you say they are consistently trying to improve these limitations. You mean with the latest releases or some package or how exactly? You know... "New Changes", "Recent Additions", etc.?
How to ensure this best? I assume stay with the latest and greatest version or else how to take advantage of those things?
 
5:06 AM
The select is going to select elements out of the document that match the selector. It's been a while since I've messed with selectors but I'm can't tell which elements you're trying to select? Just the things you can buy in the list? I think that's what you want. I'll try that.
 
I am simply trying to get the title of the product for now to practice understanding.
 
@BitcoinMurderousManiac experimental upcoming features at this stage. Best is a strong/subjective word. I'm more fascinated by it. Practical usage varies. It also heavily depends on whether or not you need to support your code/maintain it for an extended period, etc
 
@NiNisanNijackle understood. Now I am too (-: I'll let you know what I figure out
 
Understood...
 
5:10 AM
ok, thank you
 
Also I don't know much specifically about the new Python type hints, only heard about them once a few days back xD
 
So is Python as robust as Java though minus the "current" and typical data type limits? Is it like "Anything Python can do, Java can do better!", or what?
 
But in general, if possible/feasible, you should generally start a new project in the latest stable version of your target language.
 
@BitcoinMurderousManiac FWIW, Python is a strongly-typed language, but its data model is a bit different to other languages, so it may seem like it's weakly typed, like JavaScript is. I'll post a couple of links in a minute that explain what I mean, with nice diagrams.
 
@BitcoinMurderousManiac You can't really compare the entirety of Python against the entirety of Java. They are tailored to different purposes.
 
5:14 AM
May 14 at 6:35, by PM 2Ring
Mar 21 '17 at 8:27, by PM 2Ring
@Drizzy In the mean time, here are a couple of articles that explain a very important difference between Python and most other languages. Other languages have "variables", Python has "names", and Facts and myths about Python names and values, which was written by SO veteran Ned Batchelder.
 
I like to learn a lot of languages and then choose which one to used individually for each project, sometimes it's merely because I'm more familiar with a particular section of a standard library in one language than another (e.g. I'm particularly used to doing canvas drawing in JS on a webpage, and have barely touched drawing tools in Java)
 
Have you ever tried Swift's
 
@BitcoinMurderousManiac I actually prefer Python's data model. I've been using Python for about 12 years now, but I used more traditional languages for several decades before learning Python.
 
The way I like to think of it is: There are a lot of concepts and approaches to problems that can be learned by using Python/Java/etc @BitcoinMurderousManiac
@PM2Ring for me it really depends on the task. I like static typing in a lot of circumstances where I make my own complex structures
 
@NiNisanNijackle this is someting
 
5:22 AM
Oh my god I am so unmotivated right now
 
for t in shoppingList.find_all("h2", {"class": "s-access-title"}):
    print(t.text)
 
send help
 
@Cosmo Do you have something you should be working on? Are you looking for something different to play with? Those two questions aren't necessarily mutually exclusive. ;)
 
Thanks it worked. Ok I am going to go back to the docs and read up more on stuff like this. Quick quesiton though. The find all runs like a cmd + f or does it look for the exact string?
ok yes it does run like a search cmd + f it seems. Thank you!!!!
 
@PM2Ring Yes, I need to finish a literature review/project plan report for my thesis. It was due 14 hours ago.
 
5:30 AM
@Cosmo Oops. You better go and do that then. I can kick you out of the room, if it'll help. :D
 
Uhm
It might xD
 
If you're still here in 5 minutes, you're kicked. :)
 
Right on, reading over the links... yeah, I use that approach I guess for what I do with the programming languages, etc. I know for the processes I maintain utilizing either, MySQL stored procs, PowerShell, Python, batch CLI, external .Net apps, etc. In mainly Windows environments processing data exchanges, reporting, etc.
 
Fair enough. Ttyl 0/
 
One link dead BTW... I'm a sys admin / DBA taking on more stuff I suppose but Python seems promising and very cool. I recently found CPPPO module and got some cool stuff going with some PLC data processing... lol
 
5:36 AM
While I've been babbling on in here about the virtues of Python I've been collecting sweet points over on Astronomy and Physics. Yay! It's not easy to find questions I can answer over there.
 
I made the Python logic poll sensors quicker than the network device currently capturing data using Java back-end logic (8 times per 1 second or something like that) and that's going over a VPN tunnel rather than the networked capturing devices sitting there collecting on the same local network.
The logic is much more complex than this here but this question and answer helped me... yes it seems easy to get help with Python... Thank you StackExchange... Oh thank you... LOL
1
Q: Is there a method to help make this Python logic run faster

Bitcoin Murderous ManiacI've been working on a solution to grab data from a PLC sensor with Python and I was able to work out the syntax and such using cpppo and that is working just fine as far as getting the data from the tag in a loop in a presumed serialized manner. To test this new Python cpppo solution I've conne...

 
@BitcoinMurderousManiac I don't have a need for that, but it looks pretty cool.
@BitcoinMurderousManiac That's a well-written question. You deserve a cookie. :)
 
 
2 hours later…
7:28 AM
how do you get python (numpy) to print numbers like 0.0001 instead of 1e-04 ?
I don't know what words to google to ask the question
 
@Anush python numpy print without scientific notation
 
7:53 AM
Cbg
 
cbg
 
Hi. Can someone help me on how to update django database without modifying the existing queryset?
result = MyModel.objects.filter(flag=True)
Now I want to modify the result flag in database (not result acutally).
If I do, result.update(flag=False), result value also updated. I want to keep result flag as True, but update it's database value as False. So that next time someone looks up, it's value will be False.
 
I don't think you can do that.
You'll have to store the value (by consuming) and then update via another query.
 
8:18 AM
@shad0w_wa1k3r Found the answer. Thanks
 
Okay. I did the following,
result = MyModel.objects.filter(flag=True)
MyModel.objects.filter(id__in=result).update(flag=False)
print(result)
Why still my result value is updated to False?
 
8:34 AM
@NirmalRaghavan you need to consume the previous query first
Querysets in Django are lazy, and are only evaluated when they are consumed
result = list(MyModel.objects.filter(flag=True)) would be enough to consume it
 
cbg all!
So I'm writing this web API in Flask for a project that kicks off long running tensorflow training in the background and I want to make some endpoints not block when they are called. What's the easiest way to introduce something like this? I previously used Celery for this type of thing. Can the native async deal with something like this?
The general idea being someone submits a job and they get a HTTP Accepted in return then the server actually kicks off the task but doesn't block on other requests while it computes what was needed for that request
 
cabbage
@shuttle87 I hear Celery is good for that kind of thing but I have never used it nor the native async
 
I was having this discussion yesterday
 
When I used Celery it was good, but that's an library I would rather not have to introduce unless needed. It's been a while so I'm wondering if in the last 2 years there's a better way to do it now
 
My fear was that if I used one of my gunicorn processes to launch some simulation code with a non-blocking call, then gunicorn may kill the process if the user keeps browsing
turns out I couldn't launch a non-blocking call anyway
Whatever I did, the gunicorn process was always tied to the simulation. So I'm really interested if you solve this neatly :)
 
8:49 AM
Umm well celery likely TBH. Its all open sourced here: github.com/persephone-tools/persephone-web-API so you'll be able to see what I end up doing
And might depend on definitions of "neatly" :D
 
Haha. I shall watch it, thanks.
 
9:22 AM
@Anush shortcut: "numpy setprintoptions"
 
10:10 AM
How do I deal with this question? I originally answered regarding the construct of the exception handler but then found I couldn't recreate the issue (return trumps finally). Now the OP doesn't seem interested in the problem because they changed their code setup.
For anyone looking that can't see deleted answers, I did post an answer but deleted it because I don't believe it to be correct. Now the OP is asking me to give a generic answer that doesn't, I believe, solve the issue.
 
Close as unclear/too broad? NB I didn't click the link
 
I'm not sure it is too broad because it may actually be an issue that docker introduces
 
It's also a fixed issue, not a chameleon question. The code that gave the issue doesn't make sense, but it's actually perfectly valid. The issue is just not reproducible unless I learn how docker works.
 
10:25 AM
In that case move on?
 
But the OP is not interested in the issue
so I doubt they are going to test any suggestions
The question shall forever sit in a void :/
I guess I'll just move on. It's a shame because it's a problem I'm interested in and unfortunately my answer gave a path so that the OP isn't troubled by it anymore.
Actually, the OP has responded and I think I've missed something glaringly obvious
I tested that the function returned a cursor object, but not checked that it was not already closed. I was right the first time. I think last week melted my brain :/
 
11:34 AM
Hmm why I am getting a HTTP Error 400: Bad request here. My code: pastebin.com/tvXWtt3G
I also get an error if I run r = Room(6). Running r.time() or r.user() does not return an error
 
Hint: Room(self)
 
Right. time = Room(6).time() user = Room(6).user() both work. Now to work out what I need to put there
 
You want to replace Room(self) with just self.
 
@AndrasDeak thanks
 
11:50 AM
@Aran-Fey Yes it's working now. Why though?
Well it chucks up some more errors but nothing I can't fix ;)
 
no problem
 
The first parameter for Room is room_number. Is self a room number? It's not, so Room(self) doesn't make sense.
 
I see. self incorporates all the values I pass to Room() right?
 
I don't know why you're even creating new Room instances when self already exists
 
@Simon self is an instance of your class, not more, not less
 
11:53 AM
Well, more or less. self is a Room instance, but it doesn't automagically remember all the values you passed to the constructor.
It only remembers those values that you explicitly assign to it as attributes, like room_url.
 
@Simon I understood class and instance attributes after reading this
this is not to say that there aren't better resources but that was the one that I found first
 
@Aran-Fey I can therefore use self.request() rather than Room.request(self)
 
Hi all any idea why I am getting value error when I try to use cross validation in sklearn
I getting -> ValueError: Number of features of the model must match the input. Model n_features is 11 and input n_features is 12
 
@Simon can and should
@stonerock because Model n_features is 11 and input n_features is 12
apparently Number of features of the model must match the input.
 
@AndrasDeak You mean features of testdata should match input features i.e traindata
 
12:02 PM
I have no idea, but in your code's context the error should be pretty unambiguous. One of your objects has shape 11 along a given dimension, and another object has 12
Please don't ask for help with new questions here, as per the room rules. Your problem is straightforward and you'll get answers soon enough.
 
@AndrasDeak Not got it yet hence I asked here.
 
 
1 hour later…
1:18 PM
recbg
 
1:30 PM
Cbg
 
hi i am new in python and i am using python 3.6, I have a dataset in this form of lines : 'NEG\tMy food was tasteless and cold.\n', I want to split NEG and text part, how can i achieve this?
 
In other words, you want to split on \t?
 
1:46 PM
yes
 
>>> 'NEG\tMy food was tasteless and cold.\n'.split('\t')
['NEG', 'My food was tasteless and cold.\n']
 
thank you
 
2:12 PM
Is anyone familiar with natural language processing here?
 
Does anyone know if it's possible to replace \n characters in a csv file with some sort of escape sequence? I spend a lot of time manually looking through these csv files, and they're unreadable because of all the line breaks
 
I don't think that helps me. I want to replace the line breaks in the file. (i.e. there should be a line break after every row, but line breaks inside the row should be escaped)
 
replace '\n(?!$)'?
or do newlines inside count as $?
I guess the latter
but then the only way to tell where a line ends is to read (including newlines) until you get the necessary amount of separators?
or are the newlines you're looking for inside quotes?
 
2:29 PM
I just need to know if such an escape sequence exists in csv
 
I don't understand
 
i.e. I need the file to be a valid csv file, but without actual line breaks (except at the end of each row)
 
but your input is an invalid csv file?
 
no, I'm trying to write a csv file
 
you're looking for an escape sequence that is \n except it isn't?
How about r'\n'? ;)
 
2:32 PM
an escape sequence that csv readers turn into a newline, yes
I'm generating the csv file, but the one reading the file is a 3rd party program
 
I'd be surprised if such a thing existed, so far I've only seen csv readers use the standard escapes, and there's only one kind of line feed
 
this is what a single row in my csv file looks like. It's unreadable
 
yeah, that's what I suspected
how about keeping two copies: one with r'\n' for humans and one with proper newlines for csv readers?
Pannonischer Safran \o/
 
I guess that's my best option
 
2:56 PM
I'd probably have saved a few hours if I'd entered all the data manually instead of struggling to create a csv file that this horrible program can read ¯\_(ツ)_/¯
 
clearly it should use xml instead ;)
 
yes - I would've given up earlier in that case :P
(I've succeeded in importing roughly ~70% of my data, and I'll have to do the rest manually)
 
:/
I thought that just exporting your csv as-is with newlines would work, but you also want to be able to fiddle with the data manually
 
well the problem isn't that it can't read csv files; the problem is that I needed to figure out how to format the data correctly. There's a bunch of |-delimited values in the csv, for example. Getting those right took a bit of trial and error.
there's a column that's either empty or set to 0|1|1 and I have no idea what it means
stuff like that
 
Duh, look it up in the documentation!
*runs away*
 
3:10 PM
The documentation is a PRO feature and not available in the free version ;D
 
How do I remove automated numbering of rows in python dataframe
 
you can't, those are indices and they belong to a dataframe
Why do you want to remove them? You probably have an XY problem
you can set one of the columns to become an index though
>>> df = pd.DataFrame({'a':[1,2,3], 'b':[4,5,6]})
>>> df
   a  b
0  1  4
1  2  5
2  3  6
>>> df.set_index('a')
   b
a
1  4
2  5
3  6
 
I want to access my rows by index, but i have shuffled my dataframe, for example i want to use my first row its index is 421
 
df.reset_index()?
 
let me check thanks
oops no
it added a new column to my dataframe
old index and new indext
can anyone help me with leave one out cross validation? what are the parameters? how can i use train and test set? i guess the output is only index of data
 
3:33 PM
@Sahar you really need to start looking at the documentation. Tip: you need the drop keyword argument
 
@miradulo I assume I've acquired an enemy somewhere. There's one answer that doesn't address the problem in the slightest, another that uses numpy without describing what the code does, and we're guessing that I got downvoted because I used numpy
 
4:13 PM
i have a data set, each line is a review about a restaurant, i want to do sentiment analysis by naive bayes classifier, so i need the frequency of unique words, is there any library or tool for this purpose?
 
If there's a question closed as typo that won't be roomba'd because of an upvote, should I downvote or delv-pls it?
Downvoting doesn't seem right, even though the end result would be the same
 
4:28 PM
@Aran-Fey delvote with delv-pls
 
groan. Cleaning up SO sure takes a lot of effort
 
Only if you want to do it right ;) meta.stackoverflow.com/questions/307009/…
 
 
2 hours later…
6:25 PM
re-cbg
Does anyone know any decent real-time stock market data libraries?
 
6:58 PM
Baaaaaaaaaaaaaaaaaaaaaaah it's finally in
 
too much information
 
02:00 - 19:0019:00 - 00:00

« first day (2793 days earlier)      last day (2159 days later) »