|
Dominoes posted:Type 'python' in powershell. What do you see? I'm out of ideas. Python results in the Python shell being opened. Pip list works too, it's just the conda commands that aren't working. I installed miniconda on my work laptop and that works perfectly fine. Guess I'm gonna try and install mini conda on my home machine too.
|
# ? Jun 6, 2017 09:05 |
|
|
# ? Jun 3, 2024 22:23 |
|
Loch - I've no idea why the Anaconda-specific commands aren't working.shrike82 posted:Do most of you run Python in Windows? Dominoes fucked around with this message at 12:16 on Jun 6, 2017 |
# ? Jun 6, 2017 12:14 |
|
Dominoes posted:Loch - I've no idea why the Anaconda-specific commands aren't working. were you trying to replace the system python version, because you really don't ever want to do that. building from source with configure, make and make altinstall then using python3.6/pip3.6 works fine for me on centos7. literally did this today as part of an automated setup for a vm i need to do stuff on
|
# ? Jun 6, 2017 12:24 |
|
shrike82 posted:Do most of you run Python in Windows? In the brave new world of Bash for Windows, you don't really need to run VMs or dual boot if you don't want to. Ghost of Reagan Past fucked around with this message at 12:35 on Jun 6, 2017 |
# ? Jun 6, 2017 12:32 |
|
i'm a windows 7 holdout on my work laptop for reasons, does the windows subsystem for linux fix all those annoying things like not being able to run gunicorn because windows doesn't have fcntl and so on?
|
# ? Jun 6, 2017 12:40 |
|
Dex posted:were you trying to replace the system python version, because you really don't ever want to do that. building from source with configure, make and make altinstall then using python3.6/pip3.6 works fine for me on centos7. literally did this today as part of an automated setup for a vm i need to do stuff on Dominoes fucked around with this message at 14:32 on Jun 6, 2017 |
# ? Jun 6, 2017 14:30 |
|
Dex posted:i'm a windows 7 holdout on my work laptop for reasons, does the windows subsystem for linux fix all those annoying things like not being able to run gunicorn because windows doesn't have fcntl and so on?
|
# ? Jun 6, 2017 14:42 |
|
Dominoes posted:Loch - I've no idea why the Anaconda-specific commands aren't working. Thanks for all the helpful pointers over the last few days. I'm gonna try and see if I manage to get it working on my own computer with miniconda. If not I'll just manage my packages and run the applications with bash on ubuntu on windows. Or built a development environment in Virtual Box.
|
# ? Jun 6, 2017 16:03 |
|
Dominoes posted:I tried everything! At one point I had all 3 versions installed at once, but couldn't get pip to work with 3.6. Somehow broke my system beyond repair (ie fixing would be more difficult than starting fresh) troubleshooting it. I have no idea how you do that without intentionally installing into system paths. The installer defaults to your home area and will create a standalone anaconda distribution that doesn't mess with any system paths and will definitely just work It sounds like you maybe tried to replace the system python with anaconda, which is a bad idea
|
# ? Jun 7, 2017 04:26 |
|
I think the break involved trying to uninstall 3.5 or 3.6. Multiple versions on the system is awkward at best. In the future, I'd use Anaconda, which sets up things up nicely automatically, or virtual environs. There's probably a clean way to get 3.6 working in Ubuntu, but googling and troubleshooting for hours didn't do it; I'm classifying this one as difficult. It's comparatively straightforward in Windows, due to the lack of system python, and a nice official installer.
Dominoes fucked around with this message at 05:07 on Jun 7, 2017 |
# ? Jun 7, 2017 05:03 |
|
I think in general it's ill-advised to try and upgrade the system Python. So many things will break because they were made to use the specific version of Python that came with the system, so trying to replace it will cause problems
|
# ? Jun 7, 2017 05:11 |
|
RE: Miniconda instead of Anaconda. Same poo poo, also doesn't work. So I guess it's a computer specific issue. Not going to put more time into this. I'll just run all my stuff from bash and manage packages with pip. edit: I'd rather spend more time learning python than learning how to manage packages. Speaking of which, I'm creating a script that is trying to read some API's and want to write results to a sqlite db. What I'm doing so far is code:
I'm creating quite a few functions which probably won't all run all the time. Is it better to create a seperate function that does both the connecting and writing to the db seperately, so something like this: code:
LochNessMonster fucked around with this message at 12:26 on Jun 7, 2017 |
# ? Jun 7, 2017 09:04 |
|
You can totally do thiscode:
|
# ? Jun 7, 2017 12:56 |
|
LochNessMonster posted:RE: Miniconda instead of Anaconda. Hey, I don't know if it works but you might want to try using the Linux Miniconda inside bash.
|
# ? Jun 7, 2017 15:58 |
|
Ghost of Reagan Past posted:You can totally do this Awesome, that is exactly what I need. I haven't come across the conn, cur = connect_to_db() before. Does this mean that whenever conn or cur are used below that line, it'll run the connect_to_db() function to get those variables filled? Not sure if I should call them variables, they're more like connections/handlers right? Thermopyle posted:Hey, I don't know if it works but you might want to try using the Linux Miniconda inside bash. I already used pip on there, I seem to recall that using both is not a good idea. Won't that mess things up?
|
# ? Jun 7, 2017 16:17 |
|
LochNessMonster posted:Won't that mess things up? No. If you use pip (without using virtualenv) it install packages into your system python install. When you use miniconda it has its own python install that won't have anything to do with your system python. FWIW, I always use pip when I'm using miniconda. Mainly because it works just as well as `conda install` does in 99% of cases, and pip is what everyone uses.
|
# ? Jun 7, 2017 17:19 |
|
LochNessMonster posted:Not sure if I should call them variables, they're more like connections/handlers right? that syntax is just working with tuples. if you return multiple things like that, you can either catch them all in a tuple or assign them directly to variables code:
|
# ? Jun 7, 2017 17:47 |
|
^^^ LochNessMonster posted:Awesome, that is exactly what I need. I haven't come across the conn, cur = connect_to_db() before. Does this mean that whenever conn or cur are used below that line, it'll run the connect_to_db() function to get those variables filled? Not sure if I should call them variables, they're more like connections/handlers right? connect_to_db() returns 2 values, as a tuple (you don't explicitly need parentheses, it's the comma separation that does it). When you do conn, cur = connect_to_db(), you're unpacking the two values in that tuple and assigning them to those two variables. There's basically two things coming out, so you can specify a pair of variable names to assign to And those names are variables, they just point to objects representing a particular connection etc. What you want to call them depends on whether you're talking about the variable itself (if its value changes) or the thing it represents (if you assign it once and just want to refer to that specific thing). So in this case I think calling them variables makes sense, since you're specifically talking about assigning a value to the label. You'd probably just call it a handler after that though, since you're talking about what it represents now
|
# ? Jun 7, 2017 17:59 |
|
Now tell them about ... the stars.
|
# ? Jun 7, 2017 19:33 |
|
No you fool they're too powerful!!
|
# ? Jun 7, 2017 19:36 |
|
Thanks for all the great advice and explaining these concepts. I think I've learned 20% from automate the boring stuff, 20% from the python docs / stack overflow and the rest from this thread. I'm not much of a creative type but I really love building stuff with python. So thanks for being patient!
|
# ? Jun 7, 2017 20:19 |
|
fluent python owns
|
# ? Jun 7, 2017 20:38 |
Malcolm XML posted:fluent python owns
|
|
# ? Jun 7, 2017 21:39 |
|
ok, I'm semi-python competent, at least for crunching networkx alorgorithms, but I have a thing I want to do with a gui. I tried a long time ago, I'm trying again now, but I just can't understand how tkinter works. Here's what I want to see This is my dream. Maybe add a canvas in there at some point if I'm feeling REALLY ambitious So I try to use grid, and this is in my create widgets: code:
I mean, at first, I specified the first text take more rows and columns while the one below just take one row, and I still got the same thing and tried changing the second Text to Entry, and things still suck, how do I get the sizes to work in this application
|
# ? Jun 8, 2017 05:33 |
|
I'm using PyCharm and a remote interpreter inside a Docker image. It's neat but it looks like PyCharm spawns a new container each time I run some code. Is it possible to tell PyCharm to use a persistent container instead?
|
# ? Jun 8, 2017 14:14 |
|
What's the best way to go through a pandas dataframe and convert all of the values to a different value if they meet a set criteria? I've got a data frame representing grayscale images, where each cell is a value between 0 and 255, and I'd like to just convert this to black and white by changing anything that's not zero into a 1 prior to doing some analysis on it. Is this something I should use .apply for? Forgive me if this is a stupid question, but I'm really new to working with pandas and its slightly different from how a lot of python base types work.
|
# ? Jun 8, 2017 19:46 |
|
Baby Babbeh posted:What's the best way to go through a pandas dataframe and convert all of the values to a different value if they meet a set criteria? I've got a data frame representing grayscale images, where each cell is a value between 0 and 255, and I'd like to just convert this to black and white by changing anything that's not zero into a 1 prior to doing some analysis on it. Is this something I should use .apply for? df[df != 0] = 1
|
# ? Jun 8, 2017 20:40 |
|
That... makes sense. I was overcomplicating this. It returns another df rather than changing it in place, right?
|
# ? Jun 8, 2017 22:15 |
|
Baby Babbeh posted:That... makes sense. I was overcomplicating this. It returns another df rather than changing it in place, right? indices = df != 0 df[indices] = 1
|
# ? Jun 9, 2017 00:27 |
|
A few questions: 1) What are some recommended books for python with big data/data analytics? (does not have to be specific to pyspark) 2) I'm still kind of new to programming and there's a lot of stuff to take in/remember. I assume that people usually don't just code things from scratch - do you keep cheat sheets around or what?
|
# ? Jun 9, 2017 00:29 |
|
Seventh Arrow posted:2) I'm still kind of new to programming and there's a lot of stuff to take in/remember. I assume that people usually don't just code things from scratch - do you keep cheat sheets around or what? This depends what you're doing - generally yes, you code things from scratch, but because there's a bit of 'boilerplate' (stuff you have to keep writing, like the __main__ function, or class definitions, etc) then you might want to create some templates. IDEs and fancy editors can often generate 'snippets' that are like smart templates for things where you can tab between the parts you need to fill in. That said, Python isn't as verbose as something like Java so there isn't as much need for it. Look at your IDE/editor and see what it offers! There's code completion too, much less typing for you The other side of not coding things from scratch is using libraries - learning what's available and not reinventing the wheel. A lot of projects involve bolting together a few useful libraries and writing the code to do something with them. And again, if you keep making the same kinds of projects over and over (say a web server, or a twitter bot) you might want to create some skeleton projects with that basic setup already done, or a module that you can import with all that stuff in it There can be more than that (applications that generate basic projects for you, or repositories you can basically clone and get building on top of) but it depends on the language Best recommendation I can give you for remembering stuff is to get familiar with the docs. Whenever you find yourself wanting to do a thing (like manipulating a string in some way), go look at the docs for that type or module and see what methods and functions it offers. Even if you don't find something you need, you'll probably see some cool useful stuff. A lot of learning to program in a language is getting familiar with the standard library and what it can do for you
|
# ? Jun 9, 2017 00:48 |
|
I create functions for common code chunks that I either have reused before or know I will reuse later. For instance the file permission features that come bundled with Python are pretty simplistic, and at a time when I was working often with file permissions I wrote a little recursive chmod function. Now whenever I want to recursively change the permissions and ownership of a directory I just import that function. If I've forgotten how something works I either google for it or just play around with it in a terminal. Say if I forgot whether os.walk iterated over (rootname, dirs, filenames) or (filenames, dirs, rootname); opening a Python session and invoking os.walk will show you right away what's going on. If I completely forgot that os.walk was even a thing then googling around should pull it up, since Python is an extremely popular language QuarkJets fucked around with this message at 00:57 on Jun 9, 2017 |
# ? Jun 9, 2017 00:55 |
|
Seventh Arrow posted:2) I'm still kind of new to programming and there's a lot of stuff to take in/remember. I assume that people usually don't just code things from scratch - do you keep cheat sheets around or what? Kind of. I call it Google.
|
# ? Jun 9, 2017 00:57 |
|
Excellent, thanks for the answers!
|
# ? Jun 9, 2017 00:58 |
|
One day you too will reach the point where all the links in a google search for something are purple and you have to click through them to figure it out
|
# ? Jun 9, 2017 01:00 |
|
One day you'll reach a point where all the Google results are for 3.x docs no you won't
|
# ? Jun 9, 2017 01:03 |
|
Well I'm still working my way through this book and I'm going to follow it up with this one, so I think I'll have my hands busy for a while. I'm also trying to learn Apache Spark , as if that weren't enough
|
# ? Jun 9, 2017 01:32 |
|
baka kaba posted:One day you'll reach a point where all the Google results are for 3.x docs no you won't You can with py3redirect!
|
# ? Jun 9, 2017 17:00 |
|
accipter posted:You can with py3redirect! oh gently caress yes
|
# ? Jun 9, 2017 17:01 |
|
|
# ? Jun 3, 2024 22:23 |
accipter posted:You can with py3redirect!
|
|
# ? Jun 9, 2017 17:10 |