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 |
|---|---|---|---|---|---|---|---|
2018-04-18 09:29:24.593 | Scrapy - order of crawled urls | I've got an issue with scrapy and python.
I have several links. I crawl data from each of them in one script with the use of loop. But the order of crawled data is random or at least doesn't match to the link.
So I can't match url of each subpage with the outputed data.
Like: crawled url, data1, data2, data3.
Data 1, d... | Ok, It seems that the solution is in settings.py file in scrapy.
DOWNLOAD_DELAY = 3
Between requests.
It should be uncommented. Defaultly it's commented. | -0.135221 | false | 2 | 5,461 |
2018-04-18 09:29:24.593 | Scrapy - order of crawled urls | I've got an issue with scrapy and python.
I have several links. I crawl data from each of them in one script with the use of loop. But the order of crawled data is random or at least doesn't match to the link.
So I can't match url of each subpage with the outputed data.
Like: crawled url, data1, data2, data3.
Data 1, d... | time.sleep() - would it be a solution? | 0 | false | 2 | 5,461 |
2018-04-18 20:24:57.843 | gcc error when installing pyodbc | I am installing pyodbc on Redhat 6.5. Python 2.6 and 2.7.4 are installed. I get the following error below even though the header files needed for gcc are in the /usr/include/python2.6.
I have updated every dev package: yum groupinstall -y 'development tools'
Any ideas on how to resolve this issue would be greatly ap... | The resolution was to re-install Python2.7 | 0 | false | 1 | 5,462 |
2018-04-18 21:14:22.503 | Count number of nodes per level in a binary tree | I've been searching for a bit now and haven't been able to find anything similar to my question. Maybe i'm just not searching correctly. Anyways this is a question from my exam review. Given a binary tree, I need to output a list such that each item in the list is the number of nodes on a level in a binary tree at the ... | The search ordering doesn't really matter as long as you only count each node once. A depth-first search solution with recursion would be:
Create a map counters to store a counter for each level. E.g. counters[i] is the number of nodes found so far at level i. Let's say level 0 is the root.
Define a recursive function... | 0.386912 | false | 1 | 5,463 |
2018-04-19 08:06:38.817 | Going back to previous line in Spyder | I am using the Spyder editor and I have to go back and forth from the piece of code that I am writing to the definition of the functions I am calling. I am looking for shortcuts to move given this issue. I know how to go to the function definition (using Ctrl + g), but I don't know how to go back to the piece of code t... | (Spyder maintainer here) You can use the shortcuts Ctrl+Alt+Left and Ctrl+Alt+Right to move to the previous/next cursor position, respectively. | 1.2 | true | 1 | 5,464 |
2018-04-19 12:15:18.167 | clean up python versions mac osx | I tried to run a python script on my mac computer, but I ended up in troubles as it needed to install pandas as a dependency.
I tried to get this dependency, but to do so I installed different components like brew, pip, wget and others including different versions of python using brew, .pkg package downloaded from pyth... | Use brew list to see what you've installed with Brew. And Brew Uninstall as needed. Likewise, review the logs from wget to see where it installed things. Keep in mind that MacOS uses Python 2.7 for system critical tasks; it's baked-into the OS so don't touch it.
Anything you installed with pip is saved to the /site-pac... | 0.999329 | false | 1 | 5,465 |
2018-04-19 20:49:21.823 | Python/Flask: only one user can call a endpoint at one time | I have a API build using Python/Flask, and I have a endpoint called /build-task that called by the system, and this endpoint takes about 30 minutes to run.
My question is that how do I lock the /build-task endpoint when it's started and running already? So so other user, or system CANNOT call this endpoint. | You have some approaches for this problem:
1 - You can create a session object, save a flag in the object and check if the endpoint is already running and respond accordingly.
2 - Flag on the database, check if the endpoint is already running and respond accordingly. | 0.386912 | false | 1 | 5,466 |
2018-04-19 22:13:32.410 | After delay() is called on a celery task, it takes more than 5 to 10 seconds for the tasks to even start executing with redis as the server | I have Redis as my Cache Server. When I call delay() on a task,it takes more than 10 tasks to even start executing. Any idea how to reduce this unnecessary lag?
Should I replace Redis with RabbitMQ? | It's very difficult to say what the cause of the delay is without being able to inspect your application and server logs, but I can reassure you that the delay is not normal and not an effect specific to either Celery or using Redis as the broker. I've used this combination a lot in the past and execution of tasks happ... | 1.2 | true | 1 | 5,467 |
2018-04-21 12:34:46.780 | add +1 hour to datetime.time() django on forloop | I have code like this, I want to check in the time range that has overtime and sum it.
currently, am trying out.hour+1 with this code, but didn't work.
overtime_all = 5
overtime_total_hours = 0
out = datetime.time(14, 30)
while overtime_all > 0:
overtime200 = object.filter(time__range=(out, o... | I found the solution now, and this is work.
overtime_all = 5
overtime_total_hours = 0
out = datetime.time(14, 30)
while overtime_all > 0:
overtime200 = object.filter(time__range=(out,datetime.time(out.hour+1, 30))).count()
overtime_total_hours = overtime_total_hours + overtime200
... | 0.201295 | false | 2 | 5,468 |
2018-04-21 12:34:46.780 | add +1 hour to datetime.time() django on forloop | I have code like this, I want to check in the time range that has overtime and sum it.
currently, am trying out.hour+1 with this code, but didn't work.
overtime_all = 5
overtime_total_hours = 0
out = datetime.time(14, 30)
while overtime_all > 0:
overtime200 = object.filter(time__range=(out, o... | Timedelta (from datetime) can be used to increment or decrement a datatime objects. Unfortunately, it cannot be directly combined with datetime.time objects.
If the values that are stored in your time column are datetime objects, you can use them (e.g.: my_datetime + timedelta(hours=1)). If they are time objects, you'... | 1.2 | true | 2 | 5,468 |
2018-04-22 02:32:28.877 | k-means clustering multi column data in python | I Have data-set for which consist 2000 lines in a text file.
Each line represents x,y,z (3D coordinates location) of 20 skeleton joint points of human body (eg: head, shoulder center, shoulder left, shoulder right,......, elbow left, elbow right). I want to do k-means clustering of this data.
Data is separated by 'sp... | You don't need to reformat anything.
Each row is a 60 dimensional vector of continous values with a comparable scale (coordinates), as needed for k-means.
You can just run k-means on this.
But assuming that the measurements were taken in sequence, you may observe a strong correlation between rows, so I wouldn't expect ... | 1.2 | true | 1 | 5,469 |
2018-04-22 11:28:39.070 | How to get the quantity of products in specified date in odoo 10 | I want to create table in odoo 10 with the following columns: quantity_in_the_first_day_of_month,input_quantity,output_quantity,quantity_in_the_last_day_of_the_month.
but i don't know how to get the quantity of the specified date | You can join the sale order and sale order line to get specified date.
select
sum(sol.product_uom_qty)
from
sale_order s,sale_order_line sol
where
sol.order_id=s.id and
DATE(s.date_order) = '2018-01-01' | 0 | false | 1 | 5,470 |
2018-04-24 04:53:51.450 | How do CPU cores get allocated to python processes in multiprocessing? | Let's say I am running multiple python processes(not threads) on a multi core CPU (say 4). GIL is process level so GIL within a particular process won't affect other processes.
My question here is if the GIL within one process will take hold of only single core out of 4 cores or will it take hold of all 4 cores?
If one... | Process to CPU/CPU core allocation is handled by the Operating System. | 0 | false | 1 | 5,471 |
2018-04-24 13:49:41.587 | How to read back the "random-seed" from a saved model of Dynet | I have a model already trained by dynet library. But i forget the --dynet-seed parameter when training this model.
Does anyone know how to read back this parameter from the saved model?
Thank you in advance for any feedback. | You can't read back the seed parameter. Dynet model does not save the seed parameter. The obvious reason is, it is not required at testing time. Seed is only used to set fixed initial weights, random shuffling etc. for different experimental runs. At testing time no parameter initialisation or shuffling is required. So... | 1.2 | true | 1 | 5,472 |
2018-04-24 20:57:16.490 | Django/Python - Serial line concurrency | I'm currently working on gateway with an embedded Linux and a Webserver. The goal of the gateway is to retrieve data from electrical devices through a RS485/Modbus line, and to display them on a server.
I'm using Nginx and Django, and the web front-end is delivered by "static" files. Repeatedly, a Javascript script fil... | I had the same problem when I had to allow multiple processes to read some Modbus (and not only Modbus) data through a serial port. I ended up with a standalone process (“serial port server”) that exclusively works with a serial port. All other processes work with that port through that standalone process via some inte... | 0 | false | 1 | 5,473 |
2018-04-24 22:23:26.923 | Make Python 3 default on Mac OS? | I would like to ask if it is possible to make Python 3 a default interpreter on Mac OS 10 when typing python right away from the terminal? If so, can somebody help how to do it? I'm avoiding switching between the environments.
Cheers | You can do that by changing alias, typing in something like $ alias python=python3 in the terminal.
If you want the change to persist open ~/.bash_profile using nano and then add alias python=python3. CTRL+O to save and CTRL+X to close.
Then type $ source ~./bash_profile in the terminal. | 0.201295 | false | 1 | 5,474 |
2018-04-25 00:38:39.330 | can't import more than 50 contacts from csv file to telegram using Python3 | Trying to Import 200 contacts from CSV file to telegram using Python3 Code. It's working with first 50 contacts and then stop and showing below:
telethon.errors.rpc_error_list.FloodWaitError: A wait of 101 seconds is required
Any idea how I can import all list without waiting?? Thanks!! | You can not import a large number of people in sequential. ُThe telegram finds you're sperm.
As a result, you must use sleep between your requests | 0 | false | 1 | 5,475 |
2018-04-25 07:54:39.583 | Grouping tests in pytest: Classes vs plain functions | I'm using pytest to test my app.
pytest supports 2 approaches (that I'm aware of) of how to write tests:
In classes:
test_feature.py -> class TestFeature -> def test_feature_sanity
In functions:
test_feature.py -> def test_feature_sanity
Is the approach of grouping tests in a class needed? Is it allowed to back... | Typically in unit testing, the object of our tests is a single function. That is, a single function gives rise to multiple tests. In reading through test code, it's useful to have tests for a single unit be grouped together in some way (which also allows us to e.g. run all tests for a specific function), so this leaves... | 0.999909 | false | 2 | 5,476 |
2018-04-25 07:54:39.583 | Grouping tests in pytest: Classes vs plain functions | I'm using pytest to test my app.
pytest supports 2 approaches (that I'm aware of) of how to write tests:
In classes:
test_feature.py -> class TestFeature -> def test_feature_sanity
In functions:
test_feature.py -> def test_feature_sanity
Is the approach of grouping tests in a class needed? Is it allowed to back... | There are no strict rules regarding organizing tests into modules vs classes. It is a matter of personal preference. Initially I tried organizing tests into classes, after some time I realized I had no use for another level of organization. Nowadays I just collect test functions into modules (files).
I could see a vali... | 1.2 | true | 2 | 5,476 |
2018-04-25 08:16:18.483 | How to calculate a 95 credible region for a 2D joint distribution? | Suppose we have a joint distribution p(x_1,x_2), and we know x_1,x_2,p. Both are discrete, (x_1,x_2) is scatter, its contour could be drawn, marginal as well. I would like to show the area of 95% quantile (a scale of 95% data will be contained) of the joint distribution, how can I do that? | As the other points out, there are infinitely many solutions to this problem. A practical one is to find the approximate center of the point cloud and extend a circle from there until it contains approximately 95% of the data. Then, find the convex hull of the selected points and compute its area.
Of course, this will ... | 0.201295 | false | 2 | 5,477 |
2018-04-25 08:16:18.483 | How to calculate a 95 credible region for a 2D joint distribution? | Suppose we have a joint distribution p(x_1,x_2), and we know x_1,x_2,p. Both are discrete, (x_1,x_2) is scatter, its contour could be drawn, marginal as well. I would like to show the area of 95% quantile (a scale of 95% data will be contained) of the joint distribution, how can I do that? | If you are interested in finding a pair x_1, x_2 of real numbers such that
P(X_1<=x_1, X_2<=x_2) = 0.95 and your distribution is continuous then there will be infinitely many of these pairs. You might be better of just fixing one of them and then finding the other | 0 | false | 2 | 5,477 |
2018-04-25 12:20:28.077 | queires and advanced operations in influxdb | Recently started working on influxDB, can't find how to add new measurements or make a table of data from separate measurements, like in SQL we have to join table or so.
The influxdb docs aren't that clear. I'm currently using the terminal for everything and wouldn't mind switching to python but most of it is about HTT... | The InfluxDB query language does not support joins across measurements.
It instead needs to be done client side after querying data. Querying, without join, data from multiple measurements can be done with one query. | 1.2 | true | 1 | 5,478 |
2018-04-26 22:40:24.603 | Run external python file with Mininet | I try to write a defense system by using mininet + pox.
I have l3_edited file to calculate entropy. I understand when a host attacked.
I have my myTopo.py file that create a topo with Mininet.
Now my question:
I want to change hosts' ips when l3_edited detect an attack. Where should I do it?
I believe I should write ... | If someone looking for answer...
You can use your custom topology file to do other task. Multithread solved my problem. | 1.2 | true | 1 | 5,479 |
2018-04-27 12:58:39.440 | Select columns periodically on pandas DataFrame | I'm working on a Dataframe with 1116 columns, how could I select just the columns in a period of 17 ?
More clearly select the 12th, 29th,46th,63rd... columns | df.iloc[:,[i*17 for i in range(0,65)]] | 0 | false | 1 | 5,480 |
2018-04-27 15:23:38.983 | How to create different Python Wheel distributions for Ubuntu and RedHat | I have a Cython-based package which depends on other C++ SO libraries. Those libraries are binary different between Ubuntu (dev) and RedHat (prod). So the SO file generated by Cython has to be different as well. If I use Wheel to package it the file name is same for both environments:
package-version-cp27-cp27mu-linux_... | I found a solution by using a different PyPi instance. So our DEV Ubuntu environment and PROD RedHat just use two different PyPi sources.
To do that I had to make two configurations ~/.pypic and ~/.pip/pip.conf to upload. | 0 | false | 1 | 5,481 |
2018-04-28 20:06:07.330 | Why use zappa/chalice in serverless python apps? | I am new to python and thought it would be great to have my very first python project running on AWS infrastructure. Given my previous node.js experience with lambdas, I thought that every function would have its own code and the app is only glued together by the persistence layer, everything else are decoupled separat... | Benefits. You can use known concept, and adopt it in serverless.
Performance. The smaller code is the less ram it takes. It must be loaded, processed, and so on. Just to process single request? For me that was always too much.
Let's say you have diango project, that is working on elastic beanstalk, and you need some la... | 0 | false | 1 | 5,482 |
2018-04-29 13:47:46.340 | How to preprocess audio data for input into a Neural Network | I'm currently developing a keyword-spotting system that recognizes digits from 0 to 9 using deep neural networks. I have a dataset of people saying the numbers(namely the TIDIGITS dataset, collected at Texas Instruments, Inc), however the data is not prepared to be fed into a neural network, because not all the audio d... | I would split each wav by the areas of silence. Trim the silence from beginning and end. Then I'd run each one through a FFT for different sections. Smaller ones at the beginning of the sound. Then I'd normalise the frequencies against the fundamental. Then I'd feed the results into the NN as a 3d array of volumes, fre... | 0.201295 | false | 1 | 5,483 |
2018-04-29 20:58:03.330 | How would i generate a random number in python without duplicating numbers | I was wondering how to generate a random 4 digit number that has no duplicates in python 3.6
I could generate 0000-9999 but that would give me a number with a duplicate like 3445, Anyone have any ideas
thanks in advance | Generate a random number
check if there are any duplicates, if so go back to 1
you have a number with no duplicates
OR
Generate it one digit at a time from a list, removing the digit from the list at each iteration.
Generate a list with numbers 0 to 9 in it.
Create two variables, the result holding value 0, and multi... | -0.386912 | false | 1 | 5,484 |
2018-04-30 15:12:36.730 | Keras Neural Network. Preprocessing | I have this doubt when I fit a neural network in a regression problem. I preprocessed the predictors (features) of my train and test data using the methods of Imputers and Scale from sklearn.preprocessing,but I did not preprocessed the class or target of my train data or test data.
In the architecture of my neural netw... | Usually, if you are doing regression you should use a linear' activation in the last layer. A sigmoid function will 'favor' values closer to 0 and 1, so it would be harder for your model to output intermediate values.
If the distribution of your targets is gaussian or uniform I would go with a linear output layer. De-... | 0 | false | 1 | 5,485 |
2018-05-01 02:43:55.537 | How to calculate the HMAC(hsa256) of a text using a public certificate (.pem) as key | I'm working on Json Web Tokens and wanted to reproduce it using python, but I'm struggling on how to calculate the HMAC_SHA256 of the texts using a public certificate (pem file) as a key.
Does anyone know how I can accomplish that!?
Tks | In case any one found this question. The answer provided by the host works, but the idea is wrong. You don't use any RSA keys with HMAC method. The RSA key pair (public and private) are used for asymmetric algorithm while HMAC is symmetric algorithm.
In HMAC, the two sides of the communication keep the same secret text... | 0.386912 | false | 1 | 5,486 |
2018-05-01 05:40:22.107 | How to auto scale in JES | I'm coding watermarking images in JES and I was wondering how to Watermark a picture by automatically scaling a watermark image?
If anyone can help me that would be great.
Thanks. | Ill start by giving you a quote from the INFT1004 assignment you are asking for help with.
"In particular, you should try not to use code or algorithms from external sources, and not to obtain help from people other than your instructors, as this can prevent you from mastering these concepts"
It specifically says in th... | 0 | false | 1 | 5,487 |
2018-05-01 13:33:54.250 | Multi-label classification methods for large dataset | I realize there's another question with a similar title, but my dataset is very different.
I have nearly 40 million rows and about 3 thousand labels. Running a simply sklearn train_test_split takes nearly 20 minutes.
I initially was using multi-class classification models as that's all I had experience with, and realiz... | 20 minutes for this size of a job doesn't seem that long, neither does 4 hours for training.
I would really try vowpal wabbit. It excels at this sort of multilabel problem and will probably give unmatched performance if that's what you're after. It requires significant tuning and will still require quality training da... | 1.2 | true | 1 | 5,488 |
2018-05-01 20:23:34.880 | PULP: Check variable setting against constraints | I'm looking to set up a constraint-check in Python using PULP. Suppose I had variables A1,..,Xn and a constraint (AffineExpression) A1X1 + ... + AnXn <= B, where A1,..,An and B are all constants.
Given an assignment for X (e.g. X1=1, X2=4,...Xn=2), how can I check if the constraints are satisfied? I know how to do thi... | It looks like this is possible doing the following:
Define PULP variables and constraints and add them to an LpProblem
Make a dictionary of your assignments in the form {'variable name': value}
Use LpProblem.assignVarsVals(your_assignment_dict) to assign those values
Run LpProblem.valid() to check that your assignment... | 1.2 | true | 1 | 5,489 |
2018-05-02 15:18:32.357 | How to find if there are wrong values in a pandas dataframe? | I am quite new in Python coding, and I am dealing with a big dataframe for my internship.
I had an issue as sometimes there are wrong values in my dataframe. For example I find string type values ("broken leaf") instead of integer type values as ("120 cm") or (NaN).
I know there is the df.replace() function, but theref... | "120 cm" is a string, not an integer, so that's a confusing example. Some ways to find "unexpected" values include:
Use "describe" to examine the range of numerical values, to see if there are any far outside of your expected range.
Use "unique" to see the set of all values for cases where you expect a small number of... | 0 | false | 1 | 5,490 |
2018-05-03 09:34:04.367 | Read raw ethernet packet using python on Raspberry | I have a device which is sending packet with its own specific construction (header, data, crc) through its ethernet port.
What I would like to do is to communicate with this device using a Raspberry and Python 3.x.
I am already able to send Raw ethernet packet using the "socket" Library, I've checked with wireshark on ... | Did you try using ettercap package (ettercap-graphical)?
It should be available with apt.
Alternatively you can try using TCPDump (Java tool) or even check ip tables | 0 | false | 1 | 5,491 |
2018-05-04 02:07:04.457 | Host command and ifconfig giving different ips | I am using server(server_name.corp.com) inside a corporate company. On the server i am running a flask server to listen on 0.0.0.0:5000.
servers are not exposed to outside world but accessible via vpns.
Now when i run host server_name.corp.com in the box i get some ip1(10.*.*.*)
When i run ifconfig in the box it gives... | Not quite clear about the network status by your statements, I can only tell that if you want to get ip1 by python, you could use standard lib subprocess, which usually be used to execute os command. (See subprocess.Popen) | 0 | false | 1 | 5,492 |
2018-05-05 02:23:02.700 | how to use python to check if subdomain exists? | Does anyone know how to check if a subdomain exists on a website?
I am doing a sign up form and everyone gets there own subdomain, I have some javascript written on the front end but I need to find a way to check on the backend. | Do a curl or http request on subdomain which you want to verify, if you get 404 that means it doesn't exists, if you get 200 it definitely exists | 0.201295 | false | 2 | 5,493 |
2018-05-05 02:23:02.700 | how to use python to check if subdomain exists? | Does anyone know how to check if a subdomain exists on a website?
I am doing a sign up form and everyone gets there own subdomain, I have some javascript written on the front end but I need to find a way to check on the backend. | Put the assigned subdomain in a database table within unique indexed column. It will be easier to check from python (sqlalchemy, pymysql ect...) if subdomain has already been used + will automatically prevent duplicates to be assigned/inserted. | 0 | false | 2 | 5,493 |
2018-05-05 14:24:30.920 | How to use visual studio code >after< installing anaconda | If you have never installed anaconda, it seems to be rather simple. In the installation process of Anaconda, you choose to install visual studio code and that is it.
But I would like some help in my situation:
My objective: I want to use visual studio code with anaconda
I have a mac with anaconda 1.5.1 installed.
I ... | You need to select the correct python interpreter. When you are in a .py file, there's a blue bar in the bottom of the window (if you have the dark theme), there you can select the anaconda python interpreter.
Else you can open the command window with ctrl+p or command+p and type '>' for running vscode commands and sea... | 0.386912 | false | 1 | 5,494 |
2018-05-05 16:40:27.703 | Calling Python scripts from Java. Should I use Docker? | We have a Java application in our project and what we want is to call some Python script and return results from it. What is the best way to do this?
We want to isolate Python execution to avoid affecting Java application at all. Probably, Dockerizing Python is the best solution. I don't know any other way.
Then, a que... | You don’t need docker for this. There are a couple of options, you should choose depending on what your Java application is doing.
If the Java application is a client - based on swing, weblaunch, or providing UI directly - you will want to turn the python functionality to be wrapped in REST/HTTP calls.
If the Java a... | 1.2 | true | 1 | 5,495 |
2018-05-05 21:56:31.143 | Unintuitive solidity contract return values in ethereum python | I'm playing around with ethereum and python and I'm running into some weird behavior I can't make sense of. I'm having trouble understanding how return values work when calling a contract function with the python w3 client. Here's a minimal example which is confusing me in several different ways:
Contract:
pragma soli... | The returned value is the transaction hash on the blockchain. When transacting (i.e., when using "transact" rather than "call") the blockchain gets modified, and the library you are using returns the transaction hash. During that process you must have paid ether in order to be able to modify the blockchain. However, op... | 0.673066 | false | 1 | 5,496 |
2018-05-05 22:40:06.727 | Colaboratory: How to install and use on local machine? | Google Colab is awesome to work with, but I wish I can run Colab Notebooks completely locally and offline, just like Jupyter notebooks served from the local?
How do I do this? Is there a Colab package which I can install?
EDIT: Some previous answers to the question seem to give methods to access Colab hosted by Google... | Google Colab is a cloud computer,it only runs through Internet,you can design your Python script,and run the Python script through Colab,run Python will use Google Colab hardware,Google will allocate CPU, RAM, GPU and etc for your Python script,your local computer just submit Python code to Google Colab,and run,then Go... | -0.496174 | false | 1 | 5,497 |
2018-05-06 09:13:56.887 | Predicting binary classification | I have been self-learning machine learning lately, and I am now trying to solve a binary classification problem (i.e: one label which can either be true or false). I was representing this as a single column which can be 1 or 0 (true or false).
Nonetheless, I was researching and read about how categorical variables can ... | it's basically the same, when talking about binary classification, you can think of a final layer for each model that adapt the output to other model
e.g if the model output 0 or 1 than the final layer will translate it to vector like [1,0] or [0,1] and vise-versa by a threshold criteria, usually is >= 0.5
a nice bypro... | 1.2 | true | 1 | 5,498 |
2018-05-06 21:22:33.530 | Does gRPC have the ability to add a maximum retry for call? | I haven't found any examples how to add a retry logic on some rpc call. Does gRPC have the ability to add a maximum retry for call?
If so, is it a built-in function? | Retries are not a feature of gRPC Python at this time. | 1.2 | true | 1 | 5,499 |
2018-05-07 02:06:48.980 | Tensorflow How can I make a classifier from a CSV file using TensorFlow? | I need to create a classifier to identify some aphids.
My project has two parts, one with a computer vision (OpenCV), which I already conclude. The second part is with Machine Learning using TensorFlow. But I have no idea how to do it.
I have these data below that have been removed starting from the use of OpenCV, are ... | You can start with this tutorial, and try it first without changing anything; I strongly suggest this unless you are already familiar with Tensorflow so that you gain some familiarity with it.
Now you can modify the input layer of this network to match the dimensions of the HuMoments. Next, you can give a numeric label... | 0 | false | 1 | 5,500 |
2018-05-07 23:22:30.577 | How can you fill in an open dialog box in headless chrome in Python and Selenium? | I'm working with Python and Selenium to do some automation in the office, and I need to fill in an "upload file" dialog box (a windows "open" dialog box), which was invoked from a site using a headless chrome browser. Does anyone have any idea on how this could be done?
If I wasn't using a headless browser, Pywinauto c... | This turned out to not be possible. I ended up running the code on a VM and setting a registry key to allow automation to be run while the VM was minimized, disconnected, or otherwise not being interacted with by users. | 0 | false | 1 | 5,501 |
2018-05-08 10:55:31.387 | How to "compile" a python script to an "exe" file in a way it would be run as background process? | I know how to run a python script as a background process, but is there any way to compile a python script into exe file using pyinstaller or other tools so it could have no console or window ? | If you want to run it in background without "console and "window" you have to run it as a service. | 0 | false | 1 | 5,502 |
2018-05-08 12:08:02.053 | (Django) Running asynchronous server task continously in the background | I want to let a class run on my server, which contains a connected bluetooth socket and continously checks for incoming data, which can then by interpreted. In principle the class structure would look like this:
Interpreter:
-> connect (initializes the class and starts the loop)
-> loop (runs continously in the backgro... | Django on its own doesn't support any background processes - everything is request-response cycle based.
I don't know if what you're trying to do even has a dedicated name. But most certainly - it's possible. But don't tie yourself to Django with this solution.
The way I would accomplish this is I'd run a separate Pyth... | 1.2 | true | 1 | 5,503 |
2018-05-08 18:49:32.583 | Replace character with a absolute value | When searching my db all special characters work aside from the "+" - it thinks its a space. Looking on the backend which is python, there is no issues with it receiving special chars which I believe it is the frontend which is Javascript
what i need to do is replace "+" == "%2b". Is there a way for me to use create th... | You can use decodeURIComponent('%2b'), or encodeUriComponent('+');
if you decode the response from the server, you get the + sign-
if you want to replace all ocurrence just place the whole string insde the method and it decodes/encodes the whole string. | 1.2 | true | 1 | 5,504 |
2018-05-08 21:02:22.097 | How to deal with working on one project on different machines (paths)? | This is my first time coding a "project" (something more than solving exercises in single files). A number of my .py files have variables imported from a specific path. I also have a main "Run" file where I import things I've written in other files and execute the project as a whole.
Recently I've started working on t... | You should always use relative paths, not static which I assume you have got.
Assuming your in an index file and you need to access images folder, you probably have something like /users/username/project/images/image.png
Instead you want something like ../images/image.png, this tells your index file to go backwards one... | 0 | false | 1 | 5,505 |
2018-05-10 01:53:40.577 | Document similarity in production environment | We are having n number of documents. Upon submission of new document by user, our goal is to inform him about possible duplication of existing document (just like stackoverflow suggests questions may already have answer).
In our system, new document is uploaded every minute and mostly about the same topic (where there ... | You don't have to take the old model down to start training a new model, so despite any training lags, or new-document bursts, you'll always have a live model doing the best it can.
Depending on how much the document space changes over time, you might find retraining to have a negligible benefit. (One good model, built... | 1.2 | true | 1 | 5,506 |
2018-05-10 02:52:36.463 | Apache Airflow: Gunicorn Configuration File Not Being Read? | I'm trying to run Apache Airflow's webserver from a virtualenv on a Redhat machine, with some configuration options from a Gunicorn config file. Gunicorn and Airflow are both installed in the virtualenv. The command airflow webserver starts Airflow's webserver and the Gunicorn server. The config file has options to mak... | When Gunicorn is called by Airflow, it uses ~\airflow\www\gunicorn_config.py as its config file. | 1.2 | true | 1 | 5,507 |
2018-05-10 10:48:13.883 | How to make a Python Visualization as service | Integrate with website | specially sagemaker | I am from R background where we can use Plumber kind tool which provide visualization/graph as Image via end points so we can integrate in our Java application.
Now I want to integrate my Python/Juypter visualization graph with my Java application but not sure how to host it and make it as endpoint. Right now I using A... | Amazon SageMaker is a set of different services for data scientists. You are using the notebook service that is used for developing ML models in an interactive way. The hosting service in SageMaker is creating an endpoint based on a trained model. You can call this endpoint with invoke-endpoint API call for real time i... | 1.2 | true | 1 | 5,508 |
2018-05-11 04:04:54.463 | Python - Enable TLS1.2 on OSX | I have a virtualenv environment running python 3.5
Today, when I booted up my MacBook, I found myself unable to install python packages for my Django project. I get the following error:
Could not fetch URL <package URL>: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 aler... | Here is the fix:
curl https://bootstrap.pypa.io/get-pip.py | python
Execute from within the appropriate virtual environment. | 1.2 | true | 1 | 5,509 |
2018-05-11 21:19:50.853 | python Ubuntu: too many open files [eventpoll] | Basically, it is a multi-threaded crawler program, which uses requests mainly. After running the program for a few hours, I keep getting the error "Too many open files".
By running: lsof -p pid, I saw a huge number of entries like below:
python 75452 xxx 396u a_inode 0,11 0 8121 [eventpoll]
I cannot figu... | I have figured out that it is caused by Gevent. After replacing gevent with multi-thread, everything is just OK.
However, I still don't know what's wrong with gevent, which keeps opening new files(eventpoll). | 0 | false | 1 | 5,510 |
2018-05-11 22:56:26.280 | How to prepare Python Selenium project to be used on client's machine? | I've recently started freelance python programming, and was hired to write a script that scraped certain info online (nothing nefarious, just checking how often keywords appear in search results).
I wrote this script with Selenium, and now that it's done, I'm not quite sure how to prepare it to run on the client's mach... | Option 1) Deliver a Docker image if customer not to watch the browser during running and they can setup Docker environment. The Docker image should includes following items:
Python
Dependencies for running your script, like selenium
Headless chrome browser and compatible chrome webdriver binary
Your script, put them ... | 0 | false | 1 | 5,511 |
2018-05-12 09:01:11.140 | Using Hydrogen with Python 3 | The default version of python installed on my mac is python 2. I also have python 3 installed but can't install python 2.
I'd like to configure Hyrdrogen on Atom to run my script using python 3 instead.
Does anybody know how to do this? | I used jupyter kernelspec list and I found 2 kernels available, one for python2 and another for python3
So I pasted python3 kernel folder in the same directory where python2 ken=rnel is installed and removed python2 kernel using 'rm -rf python2' | 0 | false | 1 | 5,512 |
2018-05-12 09:48:08.917 | Python 3 install location | I am using Ubuntu 16.04 . Where is the python 3 installation directory ?
Running "whereis python3" in terminal gives me:
python3: /usr/bin/python3.5m-config /usr/bin/python3
/usr/bin/python3.5m /usr/bin/python3.5-config /usr/bin/python3.5
/usr/lib/python3 /usr/lib/python3.5 /etc/python3 /etc/python3.5
/us... | you can try this :
which python3 | 1.2 | true | 1 | 5,513 |
2018-05-12 10:36:33.093 | How to continue to train a model with new classes and data? | I have trained a model successfully and now I want to continue training it with new data. If a given data with the same amount of classes it works fine. But having more data then initially it will give me the error:
ValueError: Shapes (?, 14) and (?, 21) are not compatible
How can I dynamically increase the number of... | Best thing to do is to train your network from scratch with the output layers adjusted to the new output class size.
If retraining is an issue, then keep the trained network as it is and only drop the last layer. Add a new layer with the proper output size, initialized to random weights and then fine-tune (train) the e... | 0 | false | 1 | 5,514 |
2018-05-13 11:51:03.607 | transfer files between local machine and remote server | I want to make access from remote ubuntu server to local machine because I have multiple files in this machine and I want to transfer it periodically (every minute) to server how can I do that using python | You can easily transfer files between local and remote or between two remote servers. If both servers are Linux-based and require to transfer multiple files and folder using single command, however, you need to follow up below steps:
User from one remote server should have access to another remote server to correspond... | 0 | false | 1 | 5,515 |
2018-05-13 19:28:44.063 | Need help using Keras' model.predict | My goal is to make an easy neural network fit by providing 2 verticies of a certain Graph and 1 if there's a link or 0 if there's none.
I fit my model, it gets loss of about 0.40, accuracy of about 83% during fitting. I then evaluate the model by providing a batch of all positive samples and several batches of negative... | The model that you trained is not directly optimized w.r.t. the graph reconstruction. Without loss of generality, for a N-node graph, you need to predict N choose 2 links. And it may be reasonable to assume that the true values of the most of these links are 0.
When looking into your model accuracy on the 0-class and 1... | 0 | false | 1 | 5,516 |
2018-05-14 05:48:54.863 | How to used a tensor in different graphs? | I build two graphs in my code, graph1 and graph2.
There is a tensor, named embedding, in graph1. I tied to use it in graph2 by using get_variable, while the error is tensor must be from the same graph as Tensor. I found that this error occurs because they are in different graphs.
So how can I use a tensor in graph1 to... | expanding on @jdehesa's comment,
embedding could be trained initially, saved from graph1 and restored to graph2 using tensorflows saver/restore tools. for this to work you should assign embedding to a name/variable scope in graph1 and reuse the scope in graph2 | 0 | false | 1 | 5,517 |
2018-05-14 18:25:36.107 | Best practice for rollbacking a multi-purpose python script | I'm sorry if the title is a little ambiguous. Let me explain what I mean by that :
I have a python script that does a few things : creates a row in a MySQL table, inserts a json document to a MongoDB, Updates stuff in a local file, and some other stuff, mostly related to databases. Thing is, I want the whole operation... | You should implement every action to be reversible and the reverse action to be executable even if the original action has failed. Then if you have any failures, you execute every reversal. | 0 | false | 1 | 5,518 |
2018-05-15 09:13:53.017 | Why and how would you not use a python GUI framework and make one yourself like many applications including Blender do? | I have looked at a few python GUI frameworks like PyQt, wxPython and Kivy, but have noticed there aren’t many popular (used widely) python applications, from what I can find, that use them.
Blender, which is pretty popular, doesn’t seem to use them. How would one go about doing what they did/what did they do and what a... | I would say that python isn't a popular choice when it comes to making a GUI application, which is why you don't find many examples of using the GUI frameworks. tkinter, which is part of the python development is another option for GUI's.
Blender isn't really a good example as it isn't a GUI framework, it is a 3D appli... | 1.2 | true | 1 | 5,519 |
2018-05-15 19:46:31.853 | Installing Kivy to an alternate location | I have Python version 3.5 which is located here C:\Program Files(x86)\Microsoft Visual Studio\Shared\Python35_64 If I install kivy and its components and add-ons with this command: python -m pip install kivy, then it does not install in the place that I need. I want to install kivy in this location C:\Program Files(x86... | So it turned out that I again solved my problem myself, I have installed Python 3.5 and Python 3.6 on my PC, kiwy was installed in Python 3.6 by default, and my development environment was using Python 3.5, I replaced it with 3.6 and it all worked. | 0.386912 | false | 1 | 5,520 |
2018-05-16 07:28:11.157 | Portable application: s3 and Google cloud storage | I want to write an application which is portable.
With "portable" I mean that it can be used to access these storages:
amazon s3
google cloud storage
Eucalyptus Storage
The software should be developed using Python.
I am unsure how to start, since I could not find a library which supports all three storages. | You can use boto3 for accessing any services of Amazon. | 0.386912 | false | 1 | 5,521 |
2018-05-16 14:25:25.257 | How to access created nodes in a mininet topology? | I am new in mininet. I created a custom topology with 2 linear switches and 4 nodes. I need to write a python module accessing each nodes in that topology and do something but I don't know how.
Any idea please? | try the following:
s1.cmd('ifconfig s1 192.168.1.0')
h1.cmd('ifconfig h1 192.168.2.0') | 1.2 | true | 1 | 5,522 |
2018-05-16 16:07:12.060 | Real width of detected face | I've been researching like forever, but couldn't find an answer. I'm using OpenCV to detect faces, now I want to calculate the distance to the face. When I detect a face, I get a matofrect (which I can visualize with a rectangle). Pretty clear so far. But now: how do I get the width of the rectangle in the real world? ... | OpenCV's facial recognition is slightly larger than a face, therefore an average face may not be helpful. Instead, just take a picture of a face at different distances from the camera and record the distance from the camera along with the pixel width of the face for several distances. After plotting the two variables o... | 0.673066 | false | 1 | 5,523 |
2018-05-16 17:31:21.103 | Split a PDF file into two columns along a certain measurement in Python? | I have a ton of PDF files that are laid out in two columns. When I use PyPDF2 to extract the text, it reads the entire first column (which are like headers) and the entire second column. This makes splitting on the headers impossible. It's laid out in two columns:
____ __________
|Col1 Col2 ... | Using pdfminer.six successfully read from left to right with spaces in between. | 0.386912 | false | 1 | 5,524 |
2018-05-17 16:34:01.880 | how to make a copy of an sqlalchemy object (data only) | I get a db record as an sqlalchemy object and I need to consult the original values during some calculation process, so I need the original record till the end. However, the current code modifies the object as it goes and I don't want to refactor it too much at the moment.
How can I make a copy of the original data? T... | You can have many options here to copy your object.Two of them which I can think of are :
Using __dict__ it will give the dictionary of the original sqlalchemy object and you can iterate through all the attributes using .keys() function which will give all the attributes.
You can also use inspect module and getmembers... | 0 | false | 1 | 5,525 |
2018-05-18 06:14:11.447 | basic serial port contention | I am using a pi3 which talks to an arduino via serial0 (ttyAMA0)
It all works fine. I can talk to it with minicom, bidirectionally. However, a python based server also wants this port. I notice when minicom is running, the python code can write to serial0 but not read from it. At least minicom reports the python se... | Since two minicoms can attempt to use the port and there are collisions minicom must not set an advisory lock on local writes to the serial port. I guess that the first app to read received remote serial message clears it, since serial doesn't buffer. When a local app writes to serial, minicom displays this and it ge... | 0.386912 | false | 1 | 5,526 |
2018-05-18 14:53:02.983 | Effective passing of large data to python 3 functions | I am coming from a C++ programming background and am wondering if there is a pass by reference equivalent in python. The reason I am asking is that I am passing very large arrays into different functions and want to know how to do it in a way that does not waste time or memory by having copy the array to a new temporar... | Python handles function arguments in the same manner as most common languages: Java, JavaScript, C (pointers), C++ (pointers, references).
All objects are allocated on the heap. Variables are always a reference/pointer to the object. The value, which is the pointer, is copied. The object remains on the heap and is n... | 0.999329 | false | 1 | 5,527 |
2018-05-19 10:36:50.560 | How to find symbolic derivative using python without sympy? | I need to make a program which will differentiate a function, but I have no idea how to do this. I've only made a part which transforms the regular expression(x ^ 2 + 2 for example ) into reverse polish notation. Can anybody help me with creating a program which will a find symbolic derivatives of expression with + * /... | Hint: Use a recursive routine. If an operation is unary plus or minus, leave the plus or minus sign alone and continue with the operand. (That means, recursively call the derivative routine on the operand.) If an operation is addition or subtraction, leave the plus or minus sign alone and recursively find the derivativ... | 1.2 | true | 1 | 5,528 |
2018-05-19 21:46:47.500 | how to get the distance of sequence of nodes in pgr_dijkstra pgrouting? | I have an array of integers(nodes or destinations) i.e array[2,3,4,5,6,8] that need to be visited in the given sequence.
What I want is, to get the shortest distance using pgr_dijkstra. But the pgr_dijkstra finds the shortest path for two points, therefore I need to find the distance of each pair using pgr_dijkstra and... | If you want all pairs distance then use
select * from pgr_apspJohnson ('SELECT gid as id,source, target, rcost_len AS cost FROM finalroads) | 0 | false | 1 | 5,529 |
2018-05-21 10:54:03.443 | Using aws lambda to render an html page in aws lex chatbot | I have built a chatbot using AWS Lex and lambda. I have a use case where in a user enters a question (For example: What is the sale of an item in a particular region). I want that once this question is asked, a html form/pop up appears that askes the user to select the value of region and item from dropdown menus and f... | Lex has something called response cards where your can add all the possible values. These are called prompts. The user can simply select his/her choice and the slot gets filled. Lex response cards work in Facebook and slack.
In case of custom channel, you will have to custom develop the UI components. | 0 | false | 1 | 5,530 |
2018-05-22 07:22:36.627 | How to install image library in python 3.6.4 in windows 7? | I am new to Python and I am using Python 3.6.4. I also use PyCharm editor to write all my code. Please let me know how can I install Image library in Windows 7 and would it work in PyCharm too. | From pycharm,
goto settings -> project Interpreter
Click on + button on top right corner and you will get pop-up window of
Available packages. Then search for pillow, PIL image python packages.
Then click on Install package to install those packages. | 1.2 | true | 1 | 5,531 |
2018-05-23 00:28:20.643 | I have downloaded eclipse and pydev, but I am unsure how to get install django | I am attempting to learn how to create a website using python. I have been going off the advice of various websites including stackoverflow. Currently I can run code in eclipse using pydev, but I need to install django. I have no idea how to do this and I don't know who to ask or where to begin. Please help | I would recommend the following:
Install virtual environment
$pip install virtualenv
Create a new virtualenvironment
$ virtualenv django-venv
Activate virtual environment & use
$ source django-venv/bin/activate
And install django as expected
(django-venv)$ pip install django==1.11.13
(Replace with django versio... | 0 | false | 1 | 5,532 |
2018-05-23 14:46:15.693 | Proper way of streaming JSON with Django | i have a webservice which gets user requests and produces (multiple) solution(s) to this request.
I want to return a solution as soon as possible, and send the remaining solutions when they are ready.
In order to do this, I thought about using Django's Http stream response. Unfortunately, I am not sure if this is the m... | Try decoding with something like
for example
import json
json.dumps( {key: val} {key: val}, separators=('}', ':')) #check it | 0 | false | 1 | 5,533 |
2018-05-23 15:52:41.077 | pycharm won't let me run from desktop | I have been using pycharm for a while now, and I have to say that I am a real fan of it's features. I have one issue though, when I try to run a .py file from either the desktop or command prompt, I am instead prompted to use the run feature in pycharm. I consider this an issue because if I try to create a program for ... | You can try running the direct path of the file, I'm not sure what you have tried.
If you wanted to run it as I just described you would do:
py C:\~AppData\Local\Programs\Python\Python36-32\hello.py
If you move the file into your current working directory when programming, you should just be able to run py hello.py. | 1.2 | true | 1 | 5,534 |
2018-05-23 20:49:52.333 | Calling database handler class in a python thread | I'm programming a bit of server code and the MQTT side of it runs in it's own thread using the threading module which works great and no issues but now I'm wondering how to proceed.
I have two MariaDB databases, one of them is local and the other is remote (There is a good and niche reason for this.) and I'm writing a... | Writing code that is "thread safe" can be tricky. I doubt if the Python connector to MySQL is thread safe; there is very little need for it.
MySQL is quite happy to have multiple connections to it from clients. But they must be separate connections, not the same connection running in separate threads.
Very few projec... | 0 | false | 1 | 5,535 |
2018-05-25 18:54:02.363 | python logging multiple calls after each instantiation | I have multiple modules and they each have their own log. The all write to the log correctly however when a class is instantiated more than once the log will write the same line multiple times depending on the number of times it was created.
If I create the object twice it will log every messages twice, create the obj... | I was adding the handler multiple times after each instantiation of a log. I checked if the handler had already been added at the instantiation and that fixed the multiple writes. | 0 | false | 1 | 5,536 |
2018-05-28 15:00:34.117 | using c extension library with gevent | I use celery for doing snmp requests with easysnmp library which have a C interface.
The problem is lots of time is being wasted on I/O. I know that I should use eventlet or gevent in this kind of situations, but I don't know how to handle patching a third party library when it uses C extensions. | Eventlet and gevent can't monkey-patch C code.
You can offload blocking calls to OS threads with eventlet.tpool.execute(library.io_func) | 0.386912 | false | 1 | 5,537 |
2018-05-29 02:13:44.043 | How large data can Python Ray handle? | Python Ray looks interesting for machine learning applications. However, I wonder how large Python Ray can handle. Is it limited by memory or can it actually handle data that exceeds memory? | It currently works best when the data fits in memory (if you're on a cluster, then that means the aggregate memory of the cluster). If the data exceeds the available memory, then Ray will evict the least recently used objects. If those objects are needed later on, they will be reconstructed by rerunning the tasks that ... | 1.2 | true | 1 | 5,538 |
2018-05-29 18:31:38.537 | Discord bot with user specific counter | I'm trying to make a Discord bot in Python that a user can request a unit every few minutes, and later ask the bot how many units they have. Would creating a google spreadsheet for the bot to write each user's number of units to be a good idea, or is there a better way to do this? | Using a database is the best option. If you're working with a small number of users and requests you could use something even simpler like a text file for ease of use, but I'd recommend a database.
Easy to use database options include sqlite (use the sqlite3 python library) and MongoDB (I use the mongoengine python lib... | 0 | false | 1 | 5,539 |
2018-05-29 21:28:22.547 | How execute python command within virtualenv with Visual Studio Code | I have created virtual environment named virualenv. I have scrapy project and I am using there some programs installed in my virtualenv. When I run it from terminal in VSC I can see errors even when I set up my virtual environment via Ctrl+Shift+P -> Python: Select Interpreter -> Python 3.5.2(virtualenv). Interpreter w... | One way I know how,
Start cmd
Start you virtual env
(helloworld) \path\etc> code .
It will start studio code in this environment. Hope it helps | 0.386912 | false | 1 | 5,540 |
2018-05-30 15:56:33.700 | TensorFlow debug: WARNING:tensorflow:Tensor._shape is private, use Tensor.shape instead. Tensor._shape will eventually be removed | I'm new (obviously) to python, but not so new to TensorFlow
I've been trying to debug my program using breakpoint, but everytime I try to check the content of a tensor in the variable view of my Visual Studio Code debugger, the content doesn't show I get this warning in the console:
WARNING:tensorflow:Tensor._shape is... | You can simply stop at the break point, and switch to DEBUG CONSOLE panel, and type var.shape. It's not that convenient, but at least you don't need to write any extra debug code in your code. | 0 | false | 2 | 5,541 |
2018-05-30 15:56:33.700 | TensorFlow debug: WARNING:tensorflow:Tensor._shape is private, use Tensor.shape instead. Tensor._shape will eventually be removed | I'm new (obviously) to python, but not so new to TensorFlow
I've been trying to debug my program using breakpoint, but everytime I try to check the content of a tensor in the variable view of my Visual Studio Code debugger, the content doesn't show I get this warning in the console:
WARNING:tensorflow:Tensor._shape is... | Probably yes you may have to wait. In the debug mode a deprecated function is being called.
You can print out the shape explicitly by calling var.shape() in the code as a workaround. I know not very convenient. | 0 | false | 2 | 5,541 |
2018-05-30 16:38:21.447 | Django storages S3 - Store existing file | I have django 1.11 with latest django-storages, setup with S3 backend.
I am trying to programatically instantiate an ImageFile, using the AWS image link as a starting point. I cannot figure out how to do this looking at the source / documentation.
I assume I need to create a file, and give it the path derived from the... | It turns out, in several models that expect files, when using DjangoStorages, all I had to do is instead of passing a File on the file field, pass the AWS S3 object key (so not a URL, just the object key).
When model.save() is called, a boto call is made to S3 to verify an object with the provided key is there, and the... | 1.2 | true | 1 | 5,542 |
2018-05-31 22:09:08.750 | import sklearn in python | I installed miniconda for Windows10 successfully and then I could install numpy, scipy, sklearn successfully, but when I run import sklearn in python IDLE I receive No module named 'sklearn' in anaconda prompt. It recognized my python version, which was 3.6.5, correctly. I don't know what's wrong, can anyone tell me ho... | Why bot Download the full anaconda and this will install everything you need to start which includes Spider IDE, Rstudio, Jupyter and all the needed modules..
I have been using anaconda without any error and i will recommend you try it out. | 1.2 | true | 1 | 5,543 |
2018-06-01 01:04:30.917 | Pycharm Can't install TensorFlow | I cannot install tensorflow in pycharm on windows 10, though I have tried many different things:
went to settings > project interpreter and tried clicking the green plus button to install it, gave me the error: non-zero exit code (1) and told me to try installing via pip in the command line, which was successful, but ... | what worked for is this;
I installed TensorFlow on the command prompt as an administrator using this command pip install tensorflow
then I jumped back to my pycharm and clicked the red light bulb pop-up icon, it will have a few options when you click it, just select the one that says install tensor flow. This would no... | 0 | false | 1 | 5,544 |
2018-06-02 08:27:36.887 | How should I move my completed Django Project in a Virtual Environment? | I started learning django a few days back and started a project, by luck the project made is good and I'm thinking to deploy it. However I didn't initiate it in virtual environment. have made a virtual environment now and want to move project to that. I want to know how can I do that ? I have created requirements.txt w... | Django is completely unrelated to the environment you run it on.
The environment represents which python version are you using (2,3...) and the libraries installed.
To answer your question, the only thing you need to do is run your manage.py commands from the python executable in the new virtual environment. Of cours... | 1.2 | true | 1 | 5,545 |
2018-06-03 08:14:39.850 | Train CNN model with multiple folders and sub-folders | I am developing a convolution neural network (CNN) model to predict whether a patient in category 1,2,3 or 4. I use Keras on top of TensorFlow.
I have 64 breast cancer patient data, classified into four category (1=no disease, 2= …., 3=….., 4=progressive disease). In each patient's data, I have 3 set of MRI scan images... | Use os.walk to access all the files in sub-directories recursively and append to the dataset. | -0.135221 | false | 1 | 5,546 |
2018-06-03 14:02:27.027 | How can I change the default version of Python Used by Atom? | I have started using Atom recently and for the past few days, I have been searching on how to change the default version used in Atom (The default version is currently python 2.7 but I want to use 3.6). Is there anyone I can change the default path? (I have tried adding a profile to the "script" package but it still re... | Yes, there is. After starting Atom, open the script you wish to run. Then open command palette and select 'Python: Select interpreter'. A list appears with the available python versions listed. Select the one you want and hit return. Now you can run the script by placing the cursor in the edit window and right-clicking... | 0 | false | 4 | 5,547 |
2018-06-03 14:02:27.027 | How can I change the default version of Python Used by Atom? | I have started using Atom recently and for the past few days, I have been searching on how to change the default version used in Atom (The default version is currently python 2.7 but I want to use 3.6). Is there anyone I can change the default path? (I have tried adding a profile to the "script" package but it still re... | I would look in the atom installed plugins in settings.. you can get here by pressing command + shift + p, then searching for settings.
The only reason I suggest this is because, plugins is where I installed swift language usage accessibility through a plugin that manages that in atom.
Other words for plugins on atom w... | 0 | false | 4 | 5,547 |
2018-06-03 14:02:27.027 | How can I change the default version of Python Used by Atom? | I have started using Atom recently and for the past few days, I have been searching on how to change the default version used in Atom (The default version is currently python 2.7 but I want to use 3.6). Is there anyone I can change the default path? (I have tried adding a profile to the "script" package but it still re... | I came up with an inelegant solution that may not be universal. Using platformio-ide-terminal, I simply had to call python3.9 instead of python or python3. Not sure if that is exactly what you're looking for. | 0 | false | 4 | 5,547 |
2018-06-03 14:02:27.027 | How can I change the default version of Python Used by Atom? | I have started using Atom recently and for the past few days, I have been searching on how to change the default version used in Atom (The default version is currently python 2.7 but I want to use 3.6). Is there anyone I can change the default path? (I have tried adding a profile to the "script" package but it still re... | I am using script 3.18.1 in Atom 1.32.2
Navigate to Atom (at top left) > Open Preferences > Open Config folder.
Now, Expand the tree as script > lib > grammars
Open python.coffee and change 'python' to 'python3' in both the places in command argument | 0.986614 | false | 4 | 5,547 |
2018-06-04 05:13:38.857 | Line by line data from Google cloud vision API OCR | I have scanned PDFs (image based) of bank statements.
Google vision API is able to detect the text pretty accurately but it returns blocks of text and I need line by line text (bank transactions).
Any idea how to go about it? | In Google Vision API there is a method fullTextAnnotation which returns a full text string with \n specifying the end of the line, You can try that. | 0 | false | 1 | 5,548 |
2018-06-04 20:20:23.930 | XgBoost accuracy results differ on each run, with the same parameters. How can I make them constant? | The 'merror' and 'logloss' result from XGB multiclass classification differs by about 0.01 or 0.02 on each run, with the same parameters. Is this normal?
I want 'merror' and 'logloss' to be constant when I run XGB with the same parameters so I can evaluate the model precisely (e.g. when I add a new feature).
Now, if I... | Managed to solve this. First I set the 'seed' parameter of XgBoost to a fixed value, as Hadus suggested. Then I found out that I used sklearn's train_test_split function earlier in the notebook, without setting the random_state parameter to a fixed value. So I set the random_state parameter to 22 (you can use whichever... | 0 | false | 1 | 5,549 |
2018-06-04 23:38:16.783 | How to keep python programming running constantly | I made a program that grabs the top three new posts on the r/wallpaper subreddit. It downloads the pictures every 24 hours and adds them to my wallpapers folder. What I'm running into is how to have the program running in the background. The program resumes every time I turn the computer on, but it pauses whenever I cl... | Programs can't run when the computer is powered off. However, you can run a computer headlessly (without mouse, keyboard, and monitor) to save resources. Just ensure your program runs over the command line interface. | 0 | false | 1 | 5,550 |
2018-06-05 04:53:45.747 | Pandas - Read/Write to the same csv quickly.. getting permissions error | I have a script that I am trying to execute every 2 seconds.. to begin it reads a .csv with pd.read_csv. Then executes modifications on the df and finally overwrites the original .csv with to_csv.
I'm running into a PermissionError: [Errno 13] Permission denied: and from my searches I believe it's due to trying to open... | Close the file that you are trying to read and write and then try running your script.
Hope it helps | -0.201295 | false | 1 | 5,551 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.