|
Jose Cuervo posted:I wrote a small data processing script a while back and since then I have updated pandas. Now the script does not work. Short of creating a venv for a single script, is there any way of telling my system to use a specific version of pandas when running the script? Why not just use a virtualenv? virtualenvwrapper makes it a lot easier to work with virtualenv. I imagine this isn't going to be the last time you're going to have version issues so I'd suggest just making a virtualenv and setup a requirements.txt.
|
# ¿ Nov 20, 2017 20:38 |
|
|
# ¿ May 16, 2024 20:01 |
|
Boris Galerkin posted:Are there any tutorials out there that's mostly dealing with PyCharm and some of the more useful things it can do? I've been using it for a while now and it's pretty great, but I can't help but feel like I'm missing out on a lot of its functionality that I either don't know exists or don't really know how to use to full advantage. I'd say let's just share here the cool features we know. - Right Click on variable/filename/etc -> Refactor -> Rename - finds any instance of that variable and renames it. Even able to look inside strings - Navigate -> File / Class - Just learned this this week. Open any file within your project. So much quicker than navigating the file structure - Click on any part of the file path at the top of the screen and you can browse relative to the file you're currently viewing. - View -> Tool Window -> Todo - Write TODO in any comment and you can keep track of all the things you need to do. Useful when wiring up a project initially. - Debug - So glad I don't have to throw print statements everywhere now - Integration with GIT is pretty cool. Especially color changes for lines/files within your project.
|
# ¿ Dec 10, 2017 21:33 |
|
outlier posted:Python-adjacent question: Recommendations for a rich ui / internet application frontend to a Python-backed webapp? Are you building it in Django or Flask or ... hopefully you're not creating your own? Django comes with templates (https://docs.djangoproject.com/en/2.0/topics/templates/) and Flask works well with Jinja 2(http://jinja.pocoo.org/docs/2.10/). If you're using Django Rest Framwork it pairs pretty nicely with React, and I'm guessing every other front end framework out there these days (I only know React).
|
# ¿ Dec 12, 2017 16:20 |
|
outlier posted:I don't have any thoughts about the backend at the moment other than I'd like it to be a Python-based one (which I am not going to build myself). I figured the choice of frontend might constraint the backend. Will chase up Django REST. Something like React + DRF is what I do for work and it's a pretty solid pairing. There's quite a lot you'll need to read up on though. At the very least probably React, Redux, Webpack, ES6, Axios, Django, and Django Rest Framework. If you don't need a fancy front end and your back end isn't complicated I'd suggest going the Flask + Jinja 2 route.
|
# ¿ Dec 12, 2017 21:26 |
|
JVNO posted:In list logic, .remove will remove the first item in a given list that matches the query... You could iterate in reverse.
|
# ¿ Mar 2, 2018 00:26 |
|
I constantly finding myself going what is that path to the thing I need to import and I start guessing is it "Foo" or "Foo.SubFoo" or "Foo.Sub.Bar"? Is there some easy way with Python, I use Pycharm specifically, to not have to Google where to import what I need from?
|
# ¿ Mar 7, 2018 03:02 |
|
I don't know much about sorting but I do know things tend to run a lot faster when you're not printing a bunch of stuff out.
|
# ¿ Mar 18, 2018 01:47 |
|
Anyone have any recommendations for resources for learning MicroPython (with the ESP2866)? I see a few books on Amazon but none look promising and I can't really find good Youtube videos or other courses online.
|
# ¿ Mar 26, 2018 21:10 |
|
Todo apps are like the most popular way of learning backend. Google "flask/Django todo app tutorial".
|
# ¿ Apr 25, 2018 14:09 |
|
I don't really understand what's going on with your code, there are a few errors. I think what you're looking for though is something like (I'm phone posting)code:
You could also throw in a try/except in the while loop instead and toggle is_port_closed in the try block after the closePort function is called. Errors in your code include a try without an except, you never use port variable, and an else without a for. huhu fucked around with this message at 10:17 on Apr 27, 2018 |
# ¿ Apr 27, 2018 10:14 |
|
Anyone else observe PyCharm coming to a standstill for even the most basic of operations? I started a new project and was working in Sublime. I opened the same directory in Pycharm and it's taking me like ~1-2 seconds to open a directory to see what's inside. I don't have any other processes running within it and the Activity Monitor for mac is reporting up to 300% CPU usage.
|
# ¿ May 30, 2018 22:56 |
|
What the hell is happening here? I add a closing bracket and PyCharm just shits all over the formatting.
|
# ¿ Jun 9, 2018 16:39 |
|
CarForumPoster posted:I have a dumb newbie question but I feel like I'm missing something obvious. I don't see a loop anywhere? I can't be sure because I've not used the functions you're discussing but I think you're assuming something is iterating when it's not. You might want to do something like (phone posting): code:
huhu fucked around with this message at 00:59 on Jun 10, 2018 |
# ¿ Jun 10, 2018 00:56 |
|
Not trying to start some argument, genuinely curious... The constructs I use exclusively are for item in array, for item in enumerate (array), and for item in range. Are there any good uses of the basic for loop with i=0, i++?
|
# ¿ Jun 10, 2018 16:24 |
|
pmchem posted:I need to mentor people of wildly different ages, skills and backgrounds on a language new to them (in this case, Python). Project Euler is pretty good. Only need a username and password to keep track of progress. Not sure if that's quite what you're looking for. Questions increase in difficulty so people could start at different points.
|
# ¿ Jun 13, 2018 02:43 |
|
Sad Panda posted:Is there a way to bulk import a whole subdirectory? I ask because I've got 150ish files in books/, import them all manually and then call them for example using that. Maybe I'm missing something but you could just use the os package and get all the files in a directory and then iterate over them.
|
# ¿ Jul 2, 2018 03:56 |
|
Jose posted:Whats the best library for map data visualisations? Particularly if my datasets have country codes Google Maps and Flask? Edit: you could probably just write a script to spit out an HTML file.
|
# ¿ Jul 20, 2018 14:27 |
|
Could someone help me out with what I'm missing here? Just switched over two VSCode from Pycharm which used to handle all this kind of stuff for me. My issue is that I have a course I'm taking that has weekly assignments. I'd like to have a directory per week, and then a collection of utilities, such as timing functions to measure various solutions I come up with. Here is my directory structure.code:
code:
code:
It seems to be getting tripped up on the line code:
|
# ¿ Sep 1, 2018 01:06 |
|
Dr Subterfuge posted:pretty sure this would work That results in: code:
code:
huhu fucked around with this message at 02:02 on Sep 1, 2018 |
# ¿ Sep 1, 2018 01:56 |
|
Dr Subterfuge posted:And I just realized the print statement isn't a function, so this is python 2. I know some import behavior changed between 2 and 3, but I don't know if that's relevant here. That's why I tried to highlight that " some code, which I don't think is relevant to my current problem " because I couldn't even get anything to yell about it being Python 2 code.
|
# ¿ Sep 1, 2018 03:00 |
|
SurgicalOntologist posted:Edit: Oh, you're using Python 3 but have some old Python 2 code you want to run? Well, fix the import problem first, and then yes, you'll have to update timing.py. I'm leading a class at work because I'd like to learn new things. I might have spent too long as a React/Node developer that I forget the Python way of doing things or I'm just trying to force the JS way on Python. Eeeesh...
|
# ¿ Sep 1, 2018 03:41 |
|
Does anyone know of a good technique for extracting XMP Data from Photos? I used Lightroom to add a bunch of data to Photos and I'm trying to extract it all in a batch script for Django. Currently I'm using libxmp which doesn't seem to want to install on my hosting due to a bunch of non Python dependencies. Edit: Ended up editing the library and hardcoding a path to the dependency. huhu fucked around with this message at 23:23 on Oct 1, 2018 |
# ¿ Oct 1, 2018 21:49 |
|
CarForumPoster posted:I have a dumb question, at some point in developing stuff does it become more natural to read and work with json? Like are there some of you who can deal with json as intuitively as you would data in a table/dataframe? Having a way to view it can helpful. Something like this https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en or a plugin for your text editor make it easier to read. I like being able to collapse sections of a JSON doc to focus on what I need. There's also not a native way to do this, but I really like JavaScript's destructuring and found a lambda function in Python that can do it that makes it easier to split apart huge json blobs into more manageable chunks. code:
huhu fucked around with this message at 20:03 on Nov 22, 2018 |
# ¿ Nov 22, 2018 19:57 |
|
code:
|
# ¿ Dec 17, 2019 15:05 |
|
DarthRoblox posted:Yes - you're already using numpy, so sticking to numpy array functions will likely be your best bet. They're vectorized, so the entire operation happens at once instead of having to iterate cell by cell, row by row. Thanks, this looks awesome! I continued to do research and came across doing it this way: code:
code:
code:
|
# ¿ Dec 18, 2019 16:21 |
|
And a follow up question. I've got a script running that can take in video from the webcam and output it to the screen. How might I be able to turn that output into a virtual webcam so that I could use my code for Zoom or Google Hangouts? I'm not quite sure what to search for here or if it's even possible.
|
# ¿ Dec 18, 2019 16:23 |
|
I'm so lost. I've got a file uploader in Flask that's intermittently uploading the file. I can't tell if this is one bug or multiple. I've got a form: code:
code:
code:
code:
Further super weird behavior - I have an image in a directory and I can upload it just fine. However if I copy and paste it then try to upload the pasted image, it doesn't work.
|
# ¿ Mar 10, 2020 22:28 |
|
Edit: I'm doing a bunch of dumb crap. Taking a break. Carrry on.
huhu fucked around with this message at 23:15 on Mar 10, 2020 |
# ¿ Mar 10, 2020 22:58 |
|
https://micropython.org/ ?
|
# ¿ Apr 1, 2020 00:51 |
|
I have two classes Plotter and Layer. A Plotter consists of an array of layers. Each layer is an array of instructions. code:
code:
If I want to update a layer, I currently do the following: code:
And one more question. I've got a directory structure code:
code:
So I feel like I'm missing something here. huhu fucked around with this message at 18:53 on Sep 25, 2023 |
# ¿ Sep 25, 2023 18:11 |
|
I added this gross code:code:
I swear, between installing a virtual environment and getting imports, I end up just abandoning Python if my code grows out of a single file with basic imports.
|
# ¿ Sep 25, 2023 19:42 |
|
Zoracle Zed posted:You'll probably want to follow a guide like this. This will allow you to install the project path permanently to the python path. In short: Ahhhhh, this was what I was looking for. Thank you!
|
# ¿ Sep 25, 2023 19:54 |
|
I feel like every definition I’ve had of imports paints them nicely. Then I ask one follow up question and it falls apart.
|
# ¿ Sep 26, 2023 07:44 |
|
I'm writing Python to control a 2d Plotter and make art. I've been wanting to explore randomness more in depth. Currently, I've just been doing stuff like plotting a series of points with random() as in the code below. (Code might not actually work, was just trying to give a simplified idea of what I've been working on)code:
|
# ¿ Nov 14, 2023 05:56 |
|
|
# ¿ May 16, 2024 20:01 |
|
Jabor posted:One possibility is to pick a random direction and distance, instead of doing X and Y separately. How do I begin to think like this is really my question. Should I go find a book about math and art or something…
|
# ¿ Nov 14, 2023 21:22 |