Q_CreationDate stringlengths 23 23 | Title stringlengths 11 149 | Question stringlengths 25 6.53k | Answer stringlengths 15 5.1k | Score float64 -1 1.2 | Is_accepted bool 2
classes | N_answers int64 1 17 | Q_Id int64 0 6.76k |
|---|---|---|---|---|---|---|---|
2019-08-24 07:50:39.733 | How to get a callback when the specified epoch number is over? | I want to fine turn my model when using Keras, and I want to change my training data and learning rate to train when the epochs arrive 10, So how to get a callback when the specified epoch number is over. | Actually, the way keras works this is probably not the best way to go, it would be much better to treat this as fine tuning, meaning that you finish the 10 epochs, save the model and then load the model (from another script) and continue training with the lr and data you fancy.
There are several reasons for this.
It i... | 0 | false | 1 | 6,267 |
2019-08-25 13:10:47.760 | Is Python's pipenv slow? | I tried switching from venv & conda to pipenv to manage my virtual environments, but one thing I noticed about pipenv that it's oddly slow when it's doing "Locking" and it gets to the point where it stops executing for "Running out of time". Is it usually this slow or is it just me? Also, could you give me some advice ... | Pipenv is literally a joke. I spent 30 minutes staring at "Locking", which eventually fails after exactly 15 minutes, and I tried two times.
The most meaningless thirty minutes in my life.
Was my Pipfile complex? No. I included "flask" with "flake8" + "pylint" + "mypy" + "black".
Every time someone tries to fix the "de... | 0.995055 | false | 2 | 6,268 |
2019-08-25 13:10:47.760 | Is Python's pipenv slow? | I tried switching from venv & conda to pipenv to manage my virtual environments, but one thing I noticed about pipenv that it's oddly slow when it's doing "Locking" and it gets to the point where it stops executing for "Running out of time". Is it usually this slow or is it just me? Also, could you give me some advice ... | try using --skip-lock like this :
pipenv install --skip-lock
Note : do not skip-lock when going in production | 0.16183 | false | 2 | 6,268 |
2019-08-26 01:21:16.273 | Python script denied in terminal | I have a folder on my desktop that contains my script and when I run it in the pycharm ide it works perfectly but when I try to run from the terminal I get /Users/neelmukherjee/Desktop/budgeter/product_price.py: Permission denied
I'm not quite sure as to why this is happening
I tried using ls -al to check the permissi... | Ok, so I was able to figure it out. I had to use
chmod +x to help make it executable first.
chmod +x /Users/neelmukherjee/Desktop/budgeter/product_price.py
and the run /Users/neelmukherjee/Desktop/budgeter/product_price.py | 1.2 | true | 1 | 6,269 |
2019-08-26 06:10:10.417 | How to watch an hdfs directory and copy the latest file that arrives in hdfs to local? | I want to write a script in bash/python such that the script copies the latest file which arrives at hdfs directory.I know I can use inotify in local, but how to implement it in hdfs?
Can you please share the sample code for it. When I searched for it in google it gives me long codes.Is there a simpler way other than i... | Inelegant hack:
Mount hdfs using FUSE then periodically use find <mountpoint> -cmin n to get a list of files created in the last n minutes.
Then use find <mountpoint> -anewer to sort them. | 0 | false | 1 | 6,270 |
2019-08-26 22:11:31.383 | PySpark Group and apply UDF row by row operation | I have a dataset that contains 'tag' and 'date'. I need to group the data by 'tag' (this is pretty easy), then within each group count the number of row that the date for them is smaller than the date in that specific row. I basically need to loop over the rows after grouping the data. I don't know how to write a UDF w... | you need an aggregation ?
df.groupBy("tag").agg({"date":"min"})
what about that ? | 0 | false | 1 | 6,271 |
2019-08-26 23:20:06.887 | How to install stuff like Requests and BeautifulSoup to use in Python? | I am an extreme beginner with Python and its libraries and installation in general. I want to make an extremely simple google search web scraping tool. I was told to use Requests and BeautifulSoup. I have installed python3 on my Mac by using brew install python3 and I am wondering how to get those two libraries
I googl... | Since you're running with Python3, not Python (which usually refers to 2.7), you should try using pip3.
pip on the other hand, is the package installer for Python, not Python3. | 1.2 | true | 1 | 6,272 |
2019-08-27 14:17:56.143 | Stop subprocess.check_output to print on video | I'm writing a python program which uses subprocess to send files via cURL. It works, but for each file/zip it outputs the loading progress, time and other stuff which I don't want to be shown. Does anyone know how to stop it? | You should add stderr=subprocess.DEVNULL or stderr=subprocess.PIPE to your check_output call | 1.2 | true | 1 | 6,273 |
2019-08-27 15:22:51.420 | In a Jupyter Notebook how do I split a bulleted list in multiple text cells? | Suppose I have a bulleted list in Jupyter in a markdown cell like this:
Item1
Item2
Item3
Is there a way to convert this one cell list in three markdown text cells? | Ctrl + Shift + - will split a cell on cursor. Else, cannot process a text of a cell with code unless you're importing a notebook within another notebook. | 0 | false | 1 | 6,274 |
2019-08-27 17:48:12.200 | Saving large numpy 2d arrays | I have an array with ~1,000,000 rows, each of which is a numpy array of 4,800 float32 numbers.
I need to save this as a csv file, however using numpy.savetxt has been running for 30 minutes and I don't know how much longer it will run for.
Is there a faster method of saving the large array as a csv?
Many thanks,
Josh | As pointed out in the comments, 1e6 rows * 4800 columns * 4 bytes per float32 is 18GiB. Writing a float to text takes ~9 bytes of text (estimating 1 for integer, 1 for decimal, 5 for mantissa and 2 for separator), which comes out to 40GiB. This takes a long time to do, since just the conversion to text itself is non-tr... | 1.2 | true | 1 | 6,275 |
2019-08-28 08:59:57.570 | Overriding celery result table (celery_taskmeta) for Postgres | I am using celery to do some distributed tasks and want to override celery_taskmeta and add some more columns. I use Postgres as DB and SQLAlchemy as ORM. I looked up celery docs but could not find out how to do it.
Help would be appreciated. | I would suggest a different approach - add an extra table with your extended data. This table would have a foreign-key constraint that would ensure each record is related to the particular entry in the celery_taskmeta. Why this approach? - It separates your domain (domain of your application), from the Celery domain. A... | 0.386912 | false | 1 | 6,276 |
2019-08-28 14:01:28.443 | how to remove airflow install | I tried pip uninstall airflow and pip3 uninstall airflow and both return
Cannot uninstall requirement airflow, not installed
I'd like to remove airflow completely and run clean install. | Airflow now is apache-airflow. | 1.2 | true | 1 | 6,277 |
2019-08-28 16:38:47.373 | ImportError: cannot import name 'deque' from 'collections' how to clear this? | I have get
ImportError: cannot import name 'deque' from 'collections'
How to resolve this issue? I have already changed module name (the module name is collections.py) but this is not worked. | In my case I had to rename my python file from keyword.py to keyword2.py. | 0 | false | 2 | 6,278 |
2019-08-28 16:38:47.373 | ImportError: cannot import name 'deque' from 'collections' how to clear this? | I have get
ImportError: cannot import name 'deque' from 'collections'
How to resolve this issue? I have already changed module name (the module name is collections.py) but this is not worked. | I had the same problem when i run the command python -m venv <env folder>. Renamed my file from: collections.py to my_collections.py.
It worked! | 0 | false | 2 | 6,278 |
2019-08-30 04:47:58.880 | Authenticating Google Cloud Storage SDK in Cloud Functions | This is probably a really simple question, but I can't seem to find an answer online.
I'm using a Google Cloud Function to generate a CSV file and store the file in a Google Storage bucket. I've got the code working on my local machine using a json service account.
I'm wanting to push this code to a cloud function, how... | You don't need the json service account file in the cloud environment.
If the GCS bucket and GCF are in the same project, you can just directly access it.
Otherwise, add your GCF default service account(Note: it's App Engine default service account ) to your GCS project's IAM and grant relative GSC permission. | 0.999329 | false | 1 | 6,279 |
2019-08-30 15:12:00.713 | Can selenium post real traffic on a website? | I have written a script in selenium python which is basically opening up a website and clicking on links in it and doing this thing multiple times..
Purpose of the software was to increase traffic on the website but after script was made it has observed that is not posting real traffic on website while website is just ... | It does create traffic, the problem is websites sometimes defends from bots and can guess if the income connection is a bot or not, maybe you should put some time.wait(seconds) between actions to deceive the website control and make it thinks you are a person | 0 | false | 1 | 6,280 |
2019-08-30 22:08:19.797 | what are the options to implement random search? | So i want to implement random search but there is no clear cut example as to how to do this. I am confused between the following methods:
tune.randint()
ray.tune.suggest.BasicVariantGenerator()
tune.sample_from(lambda spec: blah blah np.random.choice())
Can someone please explain how and why these methods are same/di... | Generally, you don't need to use ray.tune.suggest.BasicVariantGenerator().
For the other two choices, it's up to what suits your need. tune.randint() is just a thin wrapper around tune.sample_from(lambda spec: np.random.randint(...)). You can do more expressive/conditional searches with the latter, but the former is e... | 0 | false | 1 | 6,281 |
2019-09-01 08:27:48.270 | Python Linter installation issue with VScode | [warning VSCode newbie here]
When installing pylinter from within VScode I got this message:
The script isort.exe is installed in 'C:\Users\fjanssen\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
Which is correct. However, my Python is installed in C:\Program Files\Python37\
So I am thinking Python is i... | If the goal is to simply use pylint with VS Code, then you don't need to install it globally. Create a virtual environment and select that in VS Code as your Python interpreter and then pylint will be installed there instead of globally. That way you don't have to worry about PATH. | 0.386912 | false | 1 | 6,282 |
2019-09-01 14:17:27.727 | Taking specified number of user inputs and storing each in a variable | I am a beginner in python and want to know how to take just the user specified number of inputs in one single line and store each input in a variable.
For example:
Suppose I have 3 test cases and have to pass 4 integers separated by a white space for each such test case.
The input should look like this:
3
1 0 4 3
2 5 -... | For the first part, if you would like to store input in a variable, you would do the following...
(var_name) = input()
Or if you want to treat your input as an integer, and you are sure it is an integer, you would want to do this
(var_name) = int(input())
Then you could access the input by calling up the var_na... | 0 | false | 1 | 6,283 |
2019-09-02 11:48:46.377 | How to automatically update view once the database is updated in django? | I have a problem in which I have to show data entered into a database without having to press any button or doing anything.
I am creating an app for a hospital, it has two views, one for a doctor and one for a patient.
I want as soon as the patient enters his symptoms, it shows up on doctor immediately without having t... | You can't do that with Django solely. You have to use some JS framework (React, Vue, Angular) and WebSockets, for example. | 0 | false | 1 | 6,284 |
2019-09-04 11:00:26.350 | how do I give permission to bash to run to multiple gcloud commands from local jupyter notebook | I am practicing model deployment to GCP cloud ML Engine. However, I receive errors stated below when I execute the following code section in my local jupyter notebook. Please note I do have bash installed in my local PC and environment variables are properly set.
%%bash
gcloud config set project $PROJECT
gcloud config ... | Perhaps you installed Google Cloud SDK with root?
try
sudo gcloud config set project $PROJECT
and
sudo gcloud config set compute/region $REGION | 0 | false | 1 | 6,285 |
2019-09-04 13:31:44.333 | how to use breakpoint in mydll.dll using python3 and pythonnet | I have function imported from a DLL file using pythonnet:
I need to trace my function(in a C# DLL) with Python. | you can hook a Visual Studio debugger to python.exe which runs your dll | 0 | false | 1 | 6,286 |
2019-09-04 13:40:07.500 | Python Oracle DB Connect without Oracle Client | I am trying to build an application in python which will use Oracle Database installed in corporate server and the application which I am developing can be used in any local machine.
Is it possible to connect to oracle DB in Python without installing the oracle client in the local machine where the python application ... | It is not correct that java can connect to oracle without any oracle provided software.
It needs a compatible version of ojdbc*.jar to connect. Similarly python's cx_oracle library needs oracle instant-client software from oracle to be installed.
Instant client is free software and has a small footprint. | 0.265586 | false | 2 | 6,287 |
2019-09-04 13:40:07.500 | Python Oracle DB Connect without Oracle Client | I am trying to build an application in python which will use Oracle Database installed in corporate server and the application which I am developing can be used in any local machine.
Is it possible to connect to oracle DB in Python without installing the oracle client in the local machine where the python application ... | Installing Oracle client is a huge pain. Could you instead create a Webservice to a system that does have OCI and then connect to it that way? This might end being a better solution rather than direct access. | 0 | false | 2 | 6,287 |
2019-09-05 03:55:31.020 | How to take multi-GPU support to the OpenNMT-py (pytorch)? | I used python-2.7 version to run the PyTorch with GPU support. I used this command to train the dataset using multi-GPU.
Can someone please tell me how can I fix this error with PyTorch in OpenNMT-py or is there a way to take pytorch support for multi-GPU using python 2.7?
Here is the command that I tried.
CUDA_VISI... | Maybe you can check whether your torch and python versions fit the openmt requiremen.
I remember their torch is 1.0 or 1.2 (1.0 is better). You have to lower your latest of version of torch. Hope that would work | 0 | false | 1 | 6,288 |
2019-09-05 18:28:58.863 | What does wave_read.readframes() return if there are multiple channels? | I understand how the readframes() method works for mono audio input, however I don't know how it will work for stereo input. Would it give a tuple of two byte objects? | A wave file has:
sample rate of Wave_read.getframerate() per second (e.g 44100 if from an audio CD).
sample width of Wave_read.getsampwidth() bytes (i.e 1 for 8-bit samples, 2 for 16-bit samples)
Wave_read.getnchannels() channels (typically 1 for mono, 2 for stereo)
Every time you do a Wave_read.getframes(N), you get N... | 0 | false | 1 | 6,289 |
2019-09-07 03:28:26.677 | Does SciPy have utilities for parsing and keeping track of the units associated with its constants? | scipy.constants.physical_constants returns (value, unit, uncertainty) tuples for many specific physical constants. The units are given in the form of a string. (For example, one of the options for the universal gas constant has a unit field of 'J kg^-1 K^-1'.)
At first blush, this seems pretty useful. Keeping track of ... | No, scipy the library does not have any notion of quantities with units and makes no guarantees when operating on quantities with units (from e.g. pint, astropy.Quantity or other objects from other unit-handling packages). | 0 | false | 1 | 6,290 |
2019-09-07 11:50:52.290 | LightGBM unexpected behaviour outside of jupyter | I have this strange but when I'm using a LightGBM model to calculate some predictions.
I trained a LightGBM model inside of jupyter and dumped it into a file using pickle. This model is used in an external class.
My problem is when I call my prediction function from this external class outside of jupyter it always pred... | It can't be a jupyter problem since jupyter is just an interface to communicate with python. The problem could be that you are using different python environment and different version of lgbm... Check import lightgbm as lgb and lgb.__version__ on both jupyter and your python terminal and make sure there are the same (o... | 0.386912 | false | 1 | 6,291 |
2019-09-08 16:32:01.487 | Create Python setup | I have to create a setup screen with tk that starts only at the first boot of the application where you will have to enter names etc ... a sort of setup. Does anyone have any ideas on how to do so that A) is performed only the first time and B) the input can be saved and used in the other scripts? Thanks in advance | Why not use a file to store the details? You could use a text file or you could use pickle to save a python object then reload it. On starting your application you could check to see if the file exists and contains the necessary information, if it doesn't you can activate your setup screen, if not skip it. | 0.386912 | false | 1 | 6,292 |
2019-09-09 13:09:00.117 | What is the best way to combine two data sets that depend on each other? | I am encountering a task and I am not entirely sure what the best solution is.
I currently have one data set in mongo that I use to display user data on a website, backend is in Python. A different team in the company recently created an API that has additional data that I would let to show along side the user data, an... | Synchronization will always cost more than federation. I would either A) embrace CORS and integrate it in the front-end, or B) create a thin proxy in your Python App.
Which you choose depends on how quickly this API changes, whether you can respond to those changes, and whether you need graceful degradation in case of... | 1.2 | true | 1 | 6,293 |
2019-09-09 20:26:07.763 | pandas pd.options.display.max_rows not working as expected | I’m using pandas 0.25.1 in Jupyter Lab and the maximum number of rows I can display is 10, regardless of what pd.options.display.max_rows is set to.
However, if pd.options.display.max_rows is set to less than 10 it takes effect and if pd.options.display.max_rows = None then all rows show.
Any idea how I can get a pd.o... | min_rows displays the number of rows to be displayed from the top (head) and from the bottom (tail) it will be evenly split..despite putting in an odd number. If you only want a set number of rows to be displayed without reading it into the memory,
another way is to use nrows = 'putnumberhere'.
e.g. results = pd.read_c... | -0.201295 | false | 1 | 6,294 |
2019-09-11 00:46:34.683 | Using tensorflow object detection for either or detection | I have used Tensorflow object detection for quite awhile now. I am more of a user, I dont really know how it works. I am wondering is it possible to train it to recognize an object is something and not something? For example, I want to detect cracks on the tiles. Can i use object detection to do so where i show an imag... | In case you're only expecting input images of tiles, either with defects or not, you don't need a class for no defect.
The API adds a background class for everything which is not the other classes.
So you simply need to state one class - defect, and tiles which are not detected as such are not defected.
So in your tra... | 1.2 | true | 1 | 6,295 |
2019-09-11 16:52:17.283 | How can I find memory leaks without external packages? | I am writing a data mining script to pull information off of a program called Agisoft PhotoScan for my lab. PhotoScan uses its own Python library (and I'm not sure how to access pip for this particular build), which has caused me a few problems installing other packages. After dragging, dropping, and praying, I've gott... | It turns out that the memory leak was indeed with the PhotoScan program. I've worked around it by having a separate script open and close it, running my original script once each time. Thank you all for the help! | 0 | false | 1 | 6,296 |
2019-09-15 06:56:39.743 | Start cmd and run multiple commands in the created cmd instance | I am trying to start cmd window and then running a chain of cmds in succession one after the other in that cmd window.
something like start cmd /k pipenv shell && py manage.py runserver the start cmd should open a new cmd window, which actually happens, then the pipenv shell should start a virtual environment within th... | Your py manage.py runserver command calling python executor in your major environment. In your case, you could use pipenv run manage.py runserver that detect your virtual env inside your pipfile and activate it to run your command. An alternative way is to use virtualenv that create virtual env directly inside your pro... | 0.201295 | false | 1 | 6,297 |
2019-09-15 21:33:55.463 | structured numpy ndarray, how to get values | I have a structured numpy ndarray la = {'val1':0,'val2':1} and I would like to return the vals using the 0 and 1 as keys, so I wish to return val1 when I have 0 and val2 when I have 1 which should have been straightforward however my attempts have failed, as I am not familiar with this structure.
How do I return only t... | Just found out that I can use la.tolist() and it returns a dictionary, somehow? when I wanted a list, alas from there on I was able to solve my problem. | 0 | false | 1 | 6,298 |
2019-09-16 15:19:19.583 | impossible to use pip | I start on python, I try to use mathplotlib on my code but I have an error "ModuleNotFoundError: No module named 'matplotlib'" on my cmd. So I have tried to use pip on the cmd: pip install mathplotlib.
But I have an other error "No python at 'C:...\Microsoft Visual Studio..."
Actually I don't use microsoft studio anymo... | Your setup seems messed up. A couple of ideas:
long term solution: Uninstall everything related to Python, make sure your PATH environment variables are clean, and reinstall Python from scratch.
short term solution: Since py seems to work, you could go along with it: py, py -3 -m pip install <something>, and so on.
If... | 0 | false | 1 | 6,299 |
2019-09-16 16:45:45.577 | How to create button based chatbot | I have created a chatbot using RASA to work with free text and it is working fine. As per my new requirement i need to build button based chatbot which should follow flowchart kind of structure. I don't know how to do that what i thought is to convert the flowchart into graph data structure using networkx but i am not ... | Sure, you can.
You just need each button to point to another intent. The payload of each button should point have the /intent_value as its payload and this will cause the NLU to skip evaluation and simply predict the intent. Then you can just bind a trigger to the intent or use the utter_ method.
Hope that helps. | 1.2 | true | 1 | 6,300 |
2019-09-16 19:35:35.813 | Teradataml: Remove all temporary tables created by Teradata MLE functions | In teradataml how should the user remove temporary tables created by Teradata MLE functions? | At the end of a session call remove_context() to trigger the dropping of tables. | 0 | false | 1 | 6,301 |
2019-09-17 06:03:09.647 | How to inherit controller of a third party module for customization Odoo 12? | I have a module with a controller and I need to inherit it in a newly created module for some customization. I searched about the controller inheritance in Odoo and I found that we can inherit Odoo's base modules' controllers this way:
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pa... | It is not a problem whether you are using a custom module.If the module installed in the database you can import as from odoo.addons.
Eg : from odoo.addons.your_module.controllers.main import MyClass | 1.2 | true | 1 | 6,302 |
2019-09-17 13:31:40.087 | how to deal with high cardinal categorical feature into numeric for predictive machine learning model? | I have two columns of having high cardinal categorical values, one column(area_id) has 21878 unique values and other has(page_entry) 800 unique values. I am building a predictive ML model to predict the hits on a webpage.
column information:
area_id: all the locations that were visited during the session. (has location... | One approach could be to group your categorical levels into smaller buckets using business rules. In your case for the feature area_id you could simply group them based on their geographical location, say all area_ids from a single district (or for that matter any other level of aggregation) will be replaced by a singl... | 0 | false | 1 | 6,303 |
2019-09-18 17:09:01.753 | How to restrict the maximum size of an element in a list in Python? | Problem Statement:
There are 5 sockets and 6 phones. Each phone takes 60 minutes to charge completely. What is the least time required to charge all phones?
The phones can be interchanged along the sockets
What I've tried:
I've made a list with 6 elements whose initial value is 0. I've defined two functions. Switch fun... | You cannot simply restrict the maximum element size. What you can do is check the element size with a if condition and terminate the process.
btw, answer is 6x60/5=72 mins. | 0 | false | 2 | 6,304 |
2019-09-18 17:09:01.753 | How to restrict the maximum size of an element in a list in Python? | Problem Statement:
There are 5 sockets and 6 phones. Each phone takes 60 minutes to charge completely. What is the least time required to charge all phones?
The phones can be interchanged along the sockets
What I've tried:
I've made a list with 6 elements whose initial value is 0. I've defined two functions. Switch fun... | In the charge function, add an if condition that checks the value of the element.
I'm not sure what you're add function looks like exactly, but I would define the pseudocode to look something like this:
if element < 60:
add 10 to the element
This way, if an element is greater than or equal to 60, it won't get caught by... | 0 | false | 2 | 6,304 |
2019-09-18 18:44:22.307 | how to display plot images outside of jupyter notebook? | So, this might be an utterly dumb question, but I have just started working with python and it's data science libs, and I would like to see seaborn plots displayed, but I prefer to work with editors I have experience with, like VS Code or PyCharm instead of Jupyter notebook. Of course, when I run the python code, the c... | You can try to run an matplotlib example code with python console or ipython console. They will show you a window with your plot.
Also, you can use Spyder instead of those consoles. It is free, and works well with python libraries for data science. Of course, you can check your plots in Spyder. | 0 | false | 1 | 6,305 |
2019-09-19 18:35:33.863 | Tasks linger in celery amqp when publisher is terminated | I am using Celery with a RabbitMQ server. I have a publisher, which could potentially be terminated by a SIGKILL and since this signal cannot be watched, I cannot revoke the tasks. What would be a common approach to revoke the tasks where the publisher is not alive anymore?
I experimented with an interval on the worker... | Another solution, which works in my case, is to add the next task only if the current processed ones are finished. In this case the queue doesn't fill up. | 1.2 | true | 2 | 6,306 |
2019-09-19 18:35:33.863 | Tasks linger in celery amqp when publisher is terminated | I am using Celery with a RabbitMQ server. I have a publisher, which could potentially be terminated by a SIGKILL and since this signal cannot be watched, I cannot revoke the tasks. What would be a common approach to revoke the tasks where the publisher is not alive anymore?
I experimented with an interval on the worker... | There's nothing built-in to celery to monitor the producer / publisher status -- only the worker / consumer status. There are other alternatives that you can consider, for example by using a redis expiring key that has to be updated periodically by the publisher that can serve as a proxy for whether a publisher is ali... | 0.673066 | false | 2 | 6,306 |
2019-09-19 19:03:13.597 | Python "Magic methods" are realy methods? | I know how to use magical methods in python, but I would like to understand more about them.
For it I would like to consider three examples:
1) __init__:
We use this as constructor in the beginning of most classes. If this is a method, what is the object associated with it? Is it a basic python object that is used to g... | The object is the class that's being instantiated, a.k.a. the Foo in Foo.__init__(actual_instance)
In a + b the object is a, and the expression is equivalent to a.__add__(b)
__name__ is a variable. It can't be a method because then comparisons with a string would always be False since a function is never equal to a str... | 0.201295 | false | 1 | 6,307 |
2019-09-19 21:07:37.810 | Python - how to check if user is on the desktop | I am trying to write a program with python that works like android folders bit for Windows. I want the user to be able to single click on a desktop icon and then a window will open with the contents of the folder in it. After giving up trying to find a way to allow single click to open a desktop application (for only o... | I don't know if "single clicking" would work in any way but you can use Pyautogui to automatically click as many times as you want | 0 | false | 1 | 6,308 |
2019-09-20 11:50:30.050 | How to fine-tune a keras model with existing plus newer classes? | Good day!
I have a celebrity dataset on which I want to fine-tune a keras built-in model. SO far what I have explored and done, we remove the top layers of the original model (or preferably, pass the include_top=False) and add our own layers, and then train our newly added layers while keeping the previous layers froze... | With transfer learning, you can make the trained model classify among the new classes on which you just trained using the features learned from the new dataset and the features learned by the model from the dataset on which it was trained in the first place. Unfortunately, you can not make the model to classify between... | 0.545705 | false | 1 | 6,309 |
2019-09-20 13:43:24.297 | Nvenc session limit per GPU | I'm using Imageio, the python library that wraps around ffmpeg to do hardware encoding via nvenc. My issue is that I can't get more than 2 sessions to launch (I am using non-quadro GPUs). Even using multiple GPUs. I looked over NVIDIA's support matrix and they state only 2 sessions per gpu, but it seems to be per syste... | Nvidia limits it 2 per system Not 2 per GPU. The limitation is in the driver, not the hardware. There have been unofficially drivers posted to github which remove the limitation | 1.2 | true | 1 | 6,310 |
2019-09-21 07:16:21.710 | Setup of the Divio CMS Repositories | The Divio Django CMS offers two servers: TEST and LIVE. Are these also two separate repositories? Or how is this done in the background?
I'm wondering because I would have the feeling the LIVE server is its own repository that just pulls from the TEST whenever I press deploy. Is that correct? | All Divio projects (django CMS, Python, PHP, whatever) have a Live and Test environment.
By default, both build the project from its repository's master branch (in older projects, develop).
On request, custom tracking branches can be enabled, so that the Live and Test environments will build from separate branches.
Wh... | 0.386912 | false | 1 | 6,311 |
2019-09-22 12:12:44.420 | How do i retrain the model without losing the earlier model data with new set of data | for my current requirement, I'm having a dataset of 10k+ faces from 100 different people from which I have trained a model for recognizing the face(s). The model was trained by getting the 128 vectors from the facenet_keras.h5 model and feeding those vector value to the Dense layer for classifying the faces.
But the is... | With transfer learning you would copy an existing pre-trained model and use it for a different, but similar, dataset from the original one. In your case this would be what you need to do if you want to train the model to recognize your specific 100 people.
If you already did this and you want to add another person to t... | 0.201295 | false | 1 | 6,312 |
2019-09-22 13:48:06.487 | How to debug (500) Internal Server Error on Python Waitress server? | I'm using Python and Flask, served by Waitress, to host a POST API. I'm calling the API from a C# program that posts data and gets a string response. At least 95% of the time, it works fine, but sometimes the C# program reports an error:
(500) Internal Server Error.
There is no further description of the error or why ... | Your flask application should be logging the exception when it occurs. Aside from combing through your logs (which should be stored somewhere centrally) you could consider something like Sentry.io, which is pretty easy to setup with Flask apps. | 0 | false | 1 | 6,313 |
2019-09-23 05:52:42.417 | Check inputs in csv file | I`m new to python. I have a csv file. I need to check whether the inputs are correct or not. The ode should scan through each rows.
All columns for a particular row should contain values of same type: Eg:
All columns of second row should contain only string,
All columns of third row should contain only numbers... etc... | Simple approach that can be modified:
Open df using df = pandas.from_csv(<path_to_csv>)
For each column, use df['<column_name>'] = df['<column_name>'].astype(str) (str = string, int = integer, float = float64, ..etc).
You can check column types using df.dtypes | 0.386912 | false | 1 | 6,314 |
2019-09-23 11:00:06.643 | how do I upgrade pip on Mac? | I cannot upgrade pip on my Mac from the Terminal.
According to the documentation I have to type the command:
pip install -U pip
I get the error message in the Terminal:
pip: command not found
I have Mac OS 10.14.2, python 3.7.2 and pip 18.1.
I want to upgrade to pip 19.2.3 | I have found an answer that worked for me:
sudo pip3 install -U pip --ignore-installed pip
This installed pip version 19.2.3 correctly.
It was very hard to find the correct command on the internet...glad I can share it now.
Thanks. | 0.135221 | false | 3 | 6,315 |
2019-09-23 11:00:06.643 | how do I upgrade pip on Mac? | I cannot upgrade pip on my Mac from the Terminal.
According to the documentation I have to type the command:
pip install -U pip
I get the error message in the Terminal:
pip: command not found
I have Mac OS 10.14.2, python 3.7.2 and pip 18.1.
I want to upgrade to pip 19.2.3 | pip3 install --upgrade pip
this works for me! | 0.424784 | false | 3 | 6,315 |
2019-09-23 11:00:06.643 | how do I upgrade pip on Mac? | I cannot upgrade pip on my Mac from the Terminal.
According to the documentation I have to type the command:
pip install -U pip
I get the error message in the Terminal:
pip: command not found
I have Mac OS 10.14.2, python 3.7.2 and pip 18.1.
I want to upgrade to pip 19.2.3 | I came on here to figure out the same thing but none of this things seemed to work. so I went back and looked how they were telling me to upgrade it but I still did not get it. So I just started trying things and next thing you know I seen the downloading lines and it told me that my pip was upgraded. what I used was (... | 0 | false | 3 | 6,315 |
2019-09-23 22:18:51.993 | how to remove duplicates when using pandas concat to combine two dataframe | I have two data from.
df1 with columns: id,x1,x2,x3,x4,....xn
df2 with columns: id,y.
df3 =pd.concat([df1,df2],axis=1)
when I use pandas concat to combine them, it became
id,y,id,x1,x2,x3...xn.
there are two id here.How can I get rid of one.
I have tried :
df3=pd.concat([df1,df2],axis=1).drop_duplicates().reset_index(d... | drop_duplicates() only removes rows that are completely identical.
what you're looking for is pd.merge().
pd.merge(df1, df2, on='id) | 0 | false | 1 | 6,316 |
2019-09-25 00:25:17.317 | Supremum Metric in Python for Knn with Uncertain Data | I'm trying to make a classifier for uncertain data (e.g ranged data) using python. in certain dataset, the list is a 2D array or array of record (contains float numbers for data and a string for labels), where in uncertain dataset the list is a 3D array (contains range of float numbers for data and a string for labels)... | I found out using scipy spatial distance and tweaking for-loops in standard knn helps a lot | 1.2 | true | 1 | 6,317 |
2019-09-25 13:06:45.637 | Dataflow Sideinputs - Worker Cache Size in SDK 2.x | I am experiencing performance issues in my pipeline in a DoFn that uses large side input of ~ 1GB. The side input is passed using the pvalue.AsList(), which forces materialization of the side input.
The execution graph of the pipeline shows that the particular step spends most of the time for reading the side input. Th... | If you are using AsList, you are correct that the whole side input should be loaded into memory. It may be that your worker has enough memory available, but it just takes very long to read 1GB of data into the list. Also, the size of the data that is read depends on the encoding of it. If you can share more details abo... | 0 | false | 1 | 6,318 |
2019-09-26 08:40:43.480 | Install packages with Conda for a second Python installation | I recently installed Anaconda in my Windows. I did that to use some packages from some specific channels required by an application that is using Python 3.5 as its scripting language.
I adjusted my PATH variable to use Conda, pointing to the Python environment of the particular program, but now I would like to use Cond... | Uninstall the other python installation and create different conda environments, that is what conda is great at.
Using conda from your anaconda installation to manage packages from another, independent python installation is not possible and not very feasible.
Something like this could serve your needs:
Create one en... | 1.2 | true | 1 | 6,319 |
2019-09-26 14:54:39.137 | S3 file to Mysql AWS via Airflow | I been learning how to use Apache-Airflow the last couple of months and wanted to see if anybody has any experience with transferring CSV files from S3 to a Mysql database in AWS(RDS). Or from my Local drive to MySQL.
I managed to send everything to an S3 bucket to store them in the cloud using airflow.hooks.S3_hook an... | were you able to resolve the 'MySQLdb._exceptions.OperationalError: (2068, 'LOAD DATA LOCAL INFILE file request rejected due to restrictions on access' issue | 0 | false | 1 | 6,320 |
2019-09-27 16:26:03.963 | Change column from Pandas date object to python datetime | I have a dataset with the first column as date in the format: 2011-01-01 and type(data_raw['pandas_date']) gives me pandas.core.series.Series
I want to convert the whole column into date time object so I can extract and process year/month/day from each row as required.
I used pd.to_datetime(data_raw['pandas_date']) and... | type(data_raw['pandas_date']) will always return pandas.core.series.Series, because the object data_raw['pandas_date'] is of type pandas.core.series.Series. What you want is to get the dtype, so you could just do data_raw['pandas_date'].dtype.
data_raw['pandas_date'] = pd.to_datetime(data_raw['pandas_date'])
This is ... | 1.2 | true | 1 | 6,321 |
2019-09-28 00:05:03.313 | Using BFS/DFS To Find Path With Maximum Weight in Directed Acyclic Graph | You have a 2005 Honda Accord with 50 miles (weight max) left in the tank. Which McDonalds locations (graph nodes) can you visit within a 50 mile radius? This is my question.
If you have a weighted directed acyclic graph, how can you find all the nodes that can be visited within a given weight restriction?
I am aware... | Finding the longest path to a vertex V (a McDonald's in this case) can be accomplished using topological sort. We can start by sorting our nodes topologically, since sorting topologically will always return the source node U, before the endpoint, V, of a weighted path. Then, since we would now have access to an array i... | 0 | false | 2 | 6,322 |
2019-09-28 00:05:03.313 | Using BFS/DFS To Find Path With Maximum Weight in Directed Acyclic Graph | You have a 2005 Honda Accord with 50 miles (weight max) left in the tank. Which McDonalds locations (graph nodes) can you visit within a 50 mile radius? This is my question.
If you have a weighted directed acyclic graph, how can you find all the nodes that can be visited within a given weight restriction?
I am aware... | For this problem, you will want to run a DFS from the starting node. Recurse down the graph from each child of the starting node until a total weight of over 50 is reached. If a McDonalds is encountered along the traversal record the node reached in a list or set. By doing so, you will achieve the most efficient algori... | 0 | false | 2 | 6,322 |
2019-09-29 23:15:06.167 | How does Qt Designer work in terms of creating more than 1 dialog per file? | I'm starting to use Qt Designer.
I am trying to create a game, and the first task that I want to do is to create a window where you have to input the name of the map that you want to load. If the map exists, I then switch to the main game window, and if the name of the map doesn't exist, I want to display a popup windo... | Your second option seems impossible, it would be great to share the .ui since in my years that I have worked with Qt Designer I have not been able to implement what you point out.
An .ui is an XML file that describes the elements and their properties that will be used to create a class that is used to fill a particular... | 1.2 | true | 1 | 6,323 |
2019-10-01 02:27:00.000 | Start at 100 and count up till 999 | So, this is for my assignment and I have to create a flight booking system. One of the requirements is that it should create 3 digit passenger code that does not start with zeros (e.g. 100 is the smallest acceptable value) and I have no idea how I can do it since I am a beginner and I just started to learn Python. I ha... | I like list comprehension for making a list of 100 to 999:
flights = [i for i in range(100, 1000)]
For the random version, there is probably a better way, but Random.randint(x, y) creates a random in, inclusive of the endpoints:
from random import Random
rand = Random()
flight = rand.randint(100,999)
Hope this helps wi... | 0 | false | 1 | 6,324 |
2019-10-01 07:26:35.203 | String problem / Select all values > 8000 in pandas dataframe | I want to select all values bigger than 8000 within a pandas dataframe.
new_df = df.loc[df['GM'] > 8000]
However, it is not working. I think the problem is, that the value comes from an Excel file and the number is interpreted as string e.g. "1.111,52". Do you know how I can convert such a string to float / int in ord... | You can see value of df.dtypes to see what is the type of each column. Then, if the column type is not as you want to, you can change it by df['GM'].astype(float), and then new_df = df.loc[df['GM'].astype(float) > 8000] should work as you want to. | 0.201295 | false | 1 | 6,325 |
2019-10-03 19:17:11.890 | Can we detect multiple objects in image using caltech101 dataset containing label wise images? | I have a caltech101 dataset for object detection. Can we detect multiple objects in single image using model trained on caltech101 dataset?
This dataset contains only folders (label-wise) and in each folder, some images label wise.
I have trained model on caltech101 dataset using keras and it predicts single object in... | The dataset can be used for detecting multiple objects but with below steps to be followed:
The dataset has to be annotated with bounding boxes on the object present in the image
After the annotations are done, you can use any of the Object detectors to do transfer learning and train on the annotated caltech 101 datas... | 1.2 | true | 1 | 6,326 |
2019-10-04 13:40:16.797 | Data type to save expanding data for data logging in Python | I am writing a serial data logger in Python and am wondering which data type would be best suited for this. Every few milliseconds a new value is read from the serial interface and is saved into my variable along with the current time. I don't know how long the logger is going to run, so I can't preallocate for a known... | Python doesn't have arrays as you think of them in most languages. It has "lists", which use the standard array syntax myList[0] but unlike arrays, lists can change size as needed. using myList.append(newItem) you can add more data to the list without any trouble on your part.
Since you asked for proper vocabulary in a... | 0 | false | 1 | 6,327 |
2019-10-04 20:01:45.247 | How do you push in pycharm if the commit was already done? | Once you commit in pycharm it takes you to a second window to go through with the push. But if you only hit commit and not commit/push then how do you bring up the push option. You can't do another commit unless changes are made. | In the upper menu [VCS] -> [Git...] -> [Push] | 0.673066 | false | 1 | 6,328 |
2019-10-06 17:33:10.463 | ModuleNotFoundError: No module named 'telegram' | Trying to run the python-telegram-bot library through Jupyter Notebook I get this question error. I tried many ways to reinstall it, but nothing from answers at any forums helped me. What should be a mistake and how to avoid it while installing? | Do you have a directory with "telegram" name? If you do,rename your directory and try it again to prevent import conflict.
good luck:) | 0.386912 | false | 1 | 6,329 |
2019-10-07 20:48:55.507 | argparse.print_help() ArgumentParser message string | I am writing a slack bot, and I am using argsparse to parse the arguments sent into the slackbot, but I am trying to figure out how to get the help message string so I can send it back to the user via the slack bot.
I know that ArgumentParser has a print_help() method, but that is printed via console and I need a way ... | I just found out that there's a method called format_help() that generates that help string | 0.386912 | false | 1 | 6,330 |
2019-10-07 22:25:21.107 | Is it possible to have a c++ dll run a python program in background and have it populate a map of vectors? If so, how? | There will be an unordered_map in c++ dll containing some 'vectors' mapped to its 'names'. For each of these 'names', the python code will keep on collecting data from a web server every 5 seconds and fill the vectors with it.
Is such a dll possible? If so, how to do it? | You can make the Python code into an executable. Run the executable file from the DLL as a separate process and communicate with it via TCP localhost socket - or some other Windows utility that allows to share data between different processes.
That's a slow mess. I agree, but it works.
You can also embed Python interpr... | 0 | false | 1 | 6,331 |
2019-10-08 00:10:57.677 | What is the difference between spline filtering and spline interpolation? | I'm having trouble connecting the mathematical concept of spline interpolation with the application of a spline filter in python. My very basic understanding of spline interpolation is that it's fitting the data in a piece-wise fashion, and the piece-wise polynomials fitted are called splines. But its applications in i... | I'm guessing a bit here. In order to calculate a 2nd order spline, you need the 1st derivative of the data. To calculate a 3rd order spline, you need the second derivative. I've not implemented an interpolation motor beyond 3rd order, but I suppose the 4th and 5th order splines will require at least the 3rd and 4th der... | 0.386912 | false | 1 | 6,332 |
2019-10-08 08:59:39.373 | How to show a highlighted label when The mouse is on widget | I need to know how to make a highlighted label(or small box )appears when the mouse is on widget like when you are using browser and put the mouse on (reload/back/etc...) button a small box will appear and tell you what this button do
and i want that for any widget not only widgets on toolbar | As the comment of @ekhumoro says
setToolTip is the solution | 1.2 | true | 1 | 6,333 |
2019-10-08 14:18:17.240 | xmlsec1 not found on ibm-cloud deployment | I am having hard time to install a python lib called python3-saml
To narrow down the problem I created a very simple application on ibm-cloud and I can deploy it without any problem, but when I add as a requirement the lib python3-saml
I got an exception saying:
pkgconfig.pkgconfig.PackageNotFoundError: xmlsec1 not fo... | I had a similar issue and I had to install the "xmlsec1-devel" on my CentOS system before installing the python package. | 0.386912 | false | 1 | 6,334 |
2019-10-10 09:57:25.667 | Using a function from a built-in module in your own module - Python | I'm new with Python and new on Stackoverflow, so please let me know if this question should be posted somewhere else or you need any other info :). But I hope someone can help me out with what seems to be a rather simple mistake...
I'm working with Python in Jupyter Notebook and am trying to create my own module with s... | If anyone encounters the same issue:
add 'import math' to your own module.
Make sure that you actually reload your adjusted module, e.g. by restarting your kernell! | 0 | false | 1 | 6,335 |
2019-10-10 14:40:43.443 | how to post-process raw images using rawpy to have the same effect with default output like ISP in camera? | I use rawpy module in python to post-process raw images, however, no matter how I set the Params, the output is different from the default RGB in camera ISP, so anyone know how to operate on this please?
I have tried the following ways:
Default:
output = raw.postprocess()
Use Camera White balance:
output = raw.postproc... | The dcraw/libraw/rawpy stack is based on publicly available (reverse-engineered) documentation of the various raw formats, i.e., it's not using any proprietary libraries provided by the camera vendors. As such, it can only make an educated guess at what the original camera ISP would do with any given image. Even if you... | 0 | false | 1 | 6,336 |
2019-10-11 00:23:12.790 | How does TF know what object you are finetuning for | I am trying to improve mobilenet_v2's detection of boats with about 400 images I have annotated myself, but keep on getting an underfitted model when I freeze the graphs, (detections are random does not actually seem to be detecting rather just randomly placing an inference). I performed 20,000 steps and had a loss of ... | The model works with the category labels (numbers) you give it. The string "boat" is only a translation for human convenience in reading the output.
If you have a model that has learned to identify a set of 40 images as class 9, then giving it a very similar image that you insist is class 1 will confuse it. Doing so ... | 0 | false | 2 | 6,337 |
2019-10-11 00:23:12.790 | How does TF know what object you are finetuning for | I am trying to improve mobilenet_v2's detection of boats with about 400 images I have annotated myself, but keep on getting an underfitted model when I freeze the graphs, (detections are random does not actually seem to be detecting rather just randomly placing an inference). I performed 20,000 steps and had a loss of ... | so I managed to figure out the issue.
We created the annotation tool from scratch and the issue that was causing underfitting whenever we trained regardless of the number of steps or various fixes I tried to implement was that When creating bounding boxes there was no check to identify whether the xmin and ymin coordin... | 0 | false | 2 | 6,337 |
2019-10-11 00:57:45.870 | Warehouse routes between each started workorder in production order | I'm working with odoo11 community version and currently I have some problem.
This is my exmplanation of problem:
In company I have many workcenters, and for each workcenter:
1) I want to create separate warehouse for each workcenter
or
2) Just 1 warehouse but different storage areas for each workcenter
(currently I mad... | Ok, I found my answer, which is that to accomplish what I wanted I need to use Manufacturing with Multi levell Bill of material, it working in way that theoretically 3 steps manufacturing order is divided into 3 single manufacture orders with 1 step each, and for example 2 and 3 prodcution order which before were 2 and... | 1.2 | true | 1 | 6,338 |
2019-10-11 03:40:50.427 | How to Connect Django with Python based Crawler machine? | Good day folks
Recently, I made a python based web crawler machine that scrapes_ some news ariticles and django web page that collects search title and url from users.
But I do not know how to connect the python based crawler machine and django web page together, so I am looking for the any good resources that I can re... | There are numerous ways you could do this.
You could directly integrate them together. Both use Python, so the scraper would just be written as part of Django.
You could have the scraper feed the data to a database and have Django read from that database.
You could build an API from the scraper to your Django implem... | 1.2 | true | 1 | 6,339 |
2019-10-11 08:52:05.923 | Is it possible to make a mobile app in Django? | I was wondering if it is possible for me to use Django code I have for my website and somehow use that in a mobile app, in a framework such as, for example, Flutter.
So is it possible to use the Django backend I have right now and use it in a mobile app?
So like the models, views etc... | Yes. There are a couple ways you could do it
Use the Django Rest Framework to serve as the backend for something like React Native.
Build a traditional website for mobile and then run it through a tool like PhoneGap.
Use the standard Android app tools and use Django to serve and process data through API requests. | 1.2 | true | 1 | 6,340 |
2019-10-11 09:16:29.590 | how to simulate mouse hover in robot framework on a desktop application | Can anyone please let me know how to simulate mouse hover event using robot framework on a desktop application. I.e if I mouse hover on a specific item or an object, the sub menus are listed and i need to select one of the submenu item. | It depends on the automation library that you are using to interact with the Desktop application.
The normal approach is the following:
Find the element that you want to hover on (By ID or some other unique locator)
Get the attribute position of the element (X,Y)
Move your mouse to that position.
In this way you d... | 0 | false | 1 | 6,341 |
2019-10-11 13:46:11.070 | I have a network with 3 features and 4 vector outputs. How is MSE and accuracy metric calculated? | I understand how it works when you have one column output but could not understand how it is done for 4 column outputs. | It’s not advised to calculate accuracy for continuous values. For such values you would want to calculate a measure of how close the predicted values are to the true values. This task of prediction of continuous values is known as regression. And generally R-squared value is used to measure the performance of the model... | 0.386912 | false | 1 | 6,342 |
2019-10-11 13:57:41.357 | What are the types of Python operators? | I tried type(+) hoping to know more about how is this operator represented in python but i got SyntaxError: invalid syntax.
My main problem is to cast as string representing an operation :"3+4" into the real operation to be computed in Python (so to have an int as a return: 7).
I am also trying to avoid easy solutions ... | Operators don't really have types, as they aren't values. They are just syntax whose implementation is often defined by a magic method (e.g., + is defined by the appropriate type's __add__ method).
You have to parse your string:
First, break it down into tokens: ['3', '+', '4']
Then, parse the token string into an abs... | 1.2 | true | 1 | 6,343 |
2019-10-12 16:46:51.550 | How to rotate a object trail in vpython? | I want to write a program to simulate 5-axis cnc gcode with vpython and I need to rotate trail of the object that's moving. Any idea how that can be done? | It's difficult to know exactly what you need, but if instead of using "make_trail=True" simply create a curve object to which you append points. A curve object named "c" can be rotated using the usual way to rotate an object: c.rotate(.....). | 0 | false | 1 | 6,344 |
2019-10-13 10:37:11.607 | How to extract/cut out parts of images classified by the model? | I am new to deep learning, I was wondering if there is a way to extract parts of images containing the different label and then feed those parts to different model for further processing?
For example,consider the dog vs cat classification.
Suppose the image contains both cat and dog.
We successfully classify that the i... | Your thinking is correct, you can have multiple pipelines based on the number of classes.
Training:
Main model will be an object detection and localization model like Faster RCNN, YOLO, SSD etc trained to classify at a high level like cat and dog. This pipeline provides you bounding box details (left, bottom, right, t... | 1.2 | true | 1 | 6,345 |
2019-10-13 14:56:02.397 | Creating dask_jobqueue schedulers to launch on a custom HPC | I'm new to dask and trying to use it in our cluster which uses NC job scheduler (from Runtime Design Automation, similar to LSF). I'm trying to create an NCCluster class similar to LSFCluster to keep things simple.
What are the steps involved in creating a job scheduler for custom clusters?
Is there any other way to i... | Got it working after going through the source code.
Tips for anyone trying:
Create a customCluster & customJob class similar to LSFCluster & LSFJob.
Override the following
submit_command
cancel_command
config_name (you'll have to define it in the jobqueue.yaml)
Depending on the cluster, you may need to override the ... | 1.2 | true | 1 | 6,346 |
2019-10-13 23:43:47.973 | How to run a python script using an anaconda virtual environment on mac | I am trying to get some code working on mac and to do that I have been using an anaconda virtual environment. I have all of the dependencies loaded as well as my script, but I don't know how to execute my file in the virtual environment on mac. The python file is on my desktop so please let me know how to configure the... | If you have a terminal open and are in your virtual environment then simply invoking the script should run it in your environment. | 1.2 | true | 1 | 6,347 |
2019-10-14 15:59:45.917 | Dynamically Injecting User Input Values into Python code on AWS? | I am trying to deploy a Python webapp on AWS that takes a USERNAME and PASSWORD as input from a user, inputs them into a template Python file, and logs into their Instagram account to manage it automatically.
In Depth Explanation:
I am relatively new to AWS and am really trying to create an elaborate project so I can ... | One way in which you could approach this would be have a hosted website on a static s3 bucket. Then, when submitting a request, goes to an API Gateway POST endpoint, This could then trigger a lambda (in any language of choice) passing in the two values.
This would then be passed into the event object of the lambda, you... | 0 | false | 1 | 6,348 |
2019-10-14 18:35:11.307 | how do I locate the btn by class name? | I have this html code:
<button class="_2ic5v"><span aria-label="Like" class="glyphsSpriteComment_like u-__7"></span></button>
I am trying to locate all the elements that meet this class with phyton, and selenium webdriver library:
likeBtn = driver.find_elements_by_class_name('_2ic5v')
but when I print
likeBtn
it print... | Is it button class name dynamic or static?
How if you try choose By.CssSelector?
You can find element by copy selector in element | 0 | false | 1 | 6,349 |
2019-10-15 06:25:59.843 | Trying to find text in an article that may contain quotation marks | I'm using python's findall function with a reg expression that should work but can't get the function to output results with quotation marks in them ('").
This is what I tried:
Description = findall('<p>([A-Za-z ,\.\—'":;0-9]+).</p>\n', text)
The quotation marks inside the reg expression are creating the hassle and I ... | Placing the backslash before the single quote like Sachith Rukshan suggested makes it work | 1.2 | true | 1 | 6,350 |
2019-10-16 08:45:58.897 | How to design realtime deeplearnig application for robotics using python? | I have created a machine learning software that detects objects(duh!), processes the objects based on some computer vision parameters and then triggers some hardware that puts the object in the respective bin. The objects are placed on a conveyer belt and a camera is mounted at a point to snap pictures of objects(one o... | Let me summarize everything first.
What you want to do
The "object" is on the conveyer belt
The camera will take pictures of the object
MaskRCNN will run to do the analyzing
Here are some problems you're facing
"The first problem is the time model takes to create segmentation masks, it varies from one object to an... | 1.2 | true | 1 | 6,351 |
2019-10-16 13:41:40.667 | Is there another way to plot a graph in python without matplotlib? | As the title says, that's basically it. I have tried to install matplotlib already but:
I am on Windows and "sudo" doesn't work
Every solution and answers on Stack Overflow regarding matplotlib (or some other package) not being able to be installed doesn't work for me...
I get "Error Code 1"
So! Is there any other wa... | in cmd (coammand prompt) type pip install matplotlib | -0.386912 | false | 1 | 6,352 |
2019-10-17 06:41:12.867 | File related operations python subprocess vs. native python | I have a simple task I want to perform over ssh: return all files from a given file list that do not exist.
The way I would go about doing this would be to wrap the following in an ssh session:
for f in $(files); do stat $f > /dev/null ;done
The stdout redirect will ignore all good files and then reading the stderr wil... | There are really three choices here: doing something in-process (like paramiko), running ssh directly (with subprocess), and running ssh with the shell (also with subprocess). As a general rule, avoid running the shell programmatically (as opposed to, say, upon interactive user request).
The reason is that it’s a huma... | 1.2 | true | 1 | 6,353 |
2019-10-17 13:02:33.333 | Auto activate virtual environment in Visual Studio Code | I want VS Code to turn venv on run, but I can't find how to do that.
I already tried to add to settings.json this line:
"terminal.integrated.shellArgs.windows": ["source${workspaceFolder}\env\Scripts\activate"]
But, it throws me an 127 error code. I found what 127 code means. It means, Not found. But how it can be no... | This is how I did it in 2021:
Enter Ctrl+Shift+P in your vs code.
Locate your Virtual Environment:
Python: select interpreter > Enter interpreter path > Find
Once you locate your virtual env select your python version:
your-virtual-env > bin > python3.
Now in your project you will see .vscode directory created open... | 1.2 | true | 2 | 6,354 |
2019-10-17 13:02:33.333 | Auto activate virtual environment in Visual Studio Code | I want VS Code to turn venv on run, but I can't find how to do that.
I already tried to add to settings.json this line:
"terminal.integrated.shellArgs.windows": ["source${workspaceFolder}\env\Scripts\activate"]
But, it throws me an 127 error code. I found what 127 code means. It means, Not found. But how it can be no... | There is a new flag that one can use: "python.terminal.activateEnvironment": true | 0.573727 | false | 2 | 6,354 |
2019-10-17 14:15:46.367 | Implement 1-ply, 2-ply or 3-ply search td-gammon | I've read some articles and most of them say that 3-ply improves the performance of the self-player train.
But what is this in practice? and how is that implemented? | There is stochasticity in the game because of the dice rolls, so one approach would be evaluate state positions by self play RL, and then while playing do a 2-ply search over all the possible dice combinations. That would be 36 + 6 i.e. 42 possible rolls, and then you have to make different moves that are available whi... | 0 | false | 1 | 6,355 |
2019-10-17 17:03:00.937 | Most efficient way to execute 20+ SQL Files? | I am currently overhauling a project here at work and need some advice. We currently have a morning checklist that runs daily and executes roughly 30 SQL files with 1 select statement each. This is being done in an excel macro which is very unreliable. These statements will be executed against an oracle database.
Basic... | There are lots of ways depending on how long the queries run, how much data is output, are there input parameters and what is done to the data output.
Consider:
1. Don't worry about concurrency up front
2. Write a small python app to read in every *.sql file in a directory and execute each one.
3. Modify the python app... | 0.673066 | false | 1 | 6,356 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.