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-06-06 11:33:58.087
Optimizing RAM usage when training a learning model
I have been working on creating and training a Deep Learning model for the first time. I did not have any knowledge about the subject prior to the project and therefor my knowledge is limited even now. I used to run the model on my own laptop but after implementing a well working OHE and SMOTE I simply couldnt run it o...
Slightly orthogonal to your actual question, if your high RAM usage is caused by having entire dataset in memory for the training, you could eliminate such memory footprint by reading and storing only one batch at a time: read a batch, train on this batch, read next batch and so on.
0
false
1
5,552
2018-06-07 17:31:59.093
ARIMA Forecasting
I have a time series data which looks something like this Loan_id Loan_amount Loan_drawn_date id_001 2000000 2015-7-15 id_003 100 2014-7-8 id_009 78650 2012-12-23 id_990 100 2018-11-12 I am trying to build a Arima forecasting model on this data which has round about 550 observ...
I don't know exactly about your specific domain problem, but these things apply usually in general: If the NA values represent 0 values for your domain specific problem, then replace them with 0 and then fit the ARIMA model (this would for example be the case if you are looking at daily sales and on some days you have...
1.2
true
1
5,553
2018-06-08 11:15:45.900
Randomizing lists with variables in Python 3
I'm looking for a way to randomize lists in python (which I already know how to do) but to then make sure that two things aren't next to each other. For example, if I were to be seating people and numbering the listing going down by 0, 1, 2, 3, 4, 5 based on tables but 2 people couldn't sit next to each other how would...
As you say that you know how to shuffle a list, the only requirement is that two elements are not next to each other. A simple way is to: shuffle the full list if the two elements are close, choose a random possible position for the second one exchange the two elements Maximum cost: one shuffle, one random choice, on...
1.2
true
1
5,554
2018-06-09 00:49:48.297
how to check the SD card size before mounted and do not require root
I want to check the SD card size in bash or python. Right now I know df can check it when the SD card is mounted or fdisk -l if root is available. But I want to know how to check the SD card size without requiring mounting the card to the file system or requiring the root permission? For example, if the SD card is not ...
Well, I found the lsblk -l can do the job. It tells the total size of the partitions.
0
false
1
5,555
2018-06-09 15:59:07.447
How to write a python program that 'scrapes' the results from a website for all possible combinations chosen from the given drop down menus?
There is a website that claims to predict the approximate salary of an individual on the basis of the following criteria presented in the form of individual drop-down Age : 5 options Education : 3 Options Sex : 3 Options Work Experience : 4 Options Nationality: 12 Options On clicking the Submit button, the website gi...
If you are uncomfortable asking them for database as roganjosh suggested :) use Selenium. Write in Python a script that controls Web Driver and repeatedly sends requests to all possible combinations. The script is pretty simple, just a nested loop for each type of parameter/drop down. If you are sure that value of each...
1.2
true
1
5,556
2018-06-09 16:51:02.213
Rasa-core, dealing with dates
I have a problem with rasa core, let's suppose that I have a rasa-nlu able to detect time eg "let's start tomorrow" would get the entity time: 2018-06-10:T18:39:155Z Ok, now I want next branches, or decisions to be conditioned by: time is in the past time before one month from now time is beyond 1 month I do n...
I think you could have a validation in the custom form. Where it perform validation on the time and perform next action base on the decision on the time. Your story will have to train to handle different action paths.
0
false
1
5,557
2018-06-10 13:57:31.837
Multi crtieria alterative ranking based on mixed data types
I am building a recommender system which does Multi Criteria based ranking of car alternatives. I just need to do ranking of the alternatives in a meaningful way. I have ways of asking user questions via a form. Each car will be judged on the following criteria: price, size, electric/non electric, distance etc. As you...
I am happy to see that you are willing to use multiple criteria decision making tool. You can use Analytic Hierarchy Process (AHP), Analytic Network Process (ANP), TOPSIS, VIKOR etc. Please refer relevant papers. You can also refer my papers. Krishnendu Mukherjee
-0.386912
false
1
5,558
2018-06-11 22:00:14.173
Security of SFTP packages in Python
There is plenty of info on how to use what seems to be third-party packages that allow you to access your sFTP by inputting your credentials into these packages. My dilemma is this: How do I know that these third-party packages are not sharing my credentials with developers/etc? Thank you in advance for your input.
Thanks everyone for comments. To distill it: Unless you do a code review yourself or you get a the sftp package from a verified vendor (ie - packages made by Amazon for AWS), you can not assume that these packages are "safe" and won't post your info to a third-party site.
1.2
true
1
5,559
2018-06-11 22:56:02.750
How to sync 2 streams from separate sources
Can someone point me the right direction to where I can sync up a live video and audio stream? I know it sound simple but here is my issue: We have 2 computers streaming to a single computer across multiple networks (which can be up to hundreds of miles away). All three computers have their system clocks synchronized...
A typical way to synch audio and video tracks or streams is have a timestamp for each frame or packet, which is relative to the start of the streams. This way you know that no mater how long it took to get to you, the correct audio to match with the video frame which is 20001999 (for example) milliseconds from the star...
0
false
1
5,560
2018-06-12 08:22:14.127
Python script as service has not access to asoundrc configuration file
I have a python script that records audio from an I2S MEMS microphone, connected to a Raspberry PI 3. This script runs as supposed to, when accessed from the terminal. The problem appears when i run it as a service in the background. From what i have seen, the problem is that the script as service, has no access to a...
The ~/.asoundrc file is looked for the home directory of the current user (this is what ~ means). Put it into the home directory of the user as which the service runs, or put the definitions into the global ALSA configuration file /etc/asound.conf.
1.2
true
1
5,561
2018-06-12 14:34:32.823
Odoo 10 mass mailing configure bounces
I'm using Odoo 10 mass mailing module to send newsletters. I have configured it but I don't know how to configure bounced emails. It is registering correctly sent emails, received (except that it is registering bounced as received), opened and clicks. Can anyone please help me? Regards
I managed to solve this problem. Just configured the 'bounce' system parameter to an email with the same name. Example: I created an email bounce-register@example.com. Also remember to configure the alias domain in your general settings to 'example.com' After configuring your email to register bounces you need to confi...
1.2
true
1
5,562
2018-06-14 15:07:58.413
How to predict word using trained skipgram model?
I'm using Google's Word2vec and I'm wondering how to get the top words that are predicted by a skipgram model that is trained using hierarchical softmax, given an input word? For instance, when using negative sampling, one can simply multiply an input word's embedding (from the input matrix) with each of the vectors in...
I haven't seen any way to do this, and given the way hierarchical-softmax (HS) outputs work, there's no obviously correct way to turn the output nodes' activation levels into a precise per-word likelihood estimation. Note that: the predict_output_word() method that (sort-of) simulates a negative-sampling prediction do...
0
false
1
5,563
2018-06-15 06:29:25.043
ImportError: cannot import name _remove_dead_weakref python 2.7
I use windows 7 and python 2.7 When I used py2exe to make an .exe file I get the error; Traceback (most recent call last): File "mainpy", line 17, in File "main.py", line 17, in File "zipextimporter.pyc", line 82, in load_module File "zipextimporter.pyc", line 82, in load_module File "logging_init_.pyc", line 26, in Fi...
It is possible that the library does not exists for the other computer.Please check whether the library exists or not.
0
false
1
5,564
2018-06-15 08:06:21.200
finding length of linked list in constant time python
I'm trying to write a function which finds the length of a linked list in O(1). I know how to implement it in O(n) but I can't figure out how to do it in constant time... is that even possible?
Its not possible because you have to atleast pass through entire linked list and it takes O(n) Else you have to use a variable which counts when inserting elements into linked list
0
false
1
5,565
2018-06-15 21:13:27.137
Accessing Hidden Tabs, Web Scraping With Python 3.6
I'm using bs4 and urllib.request in python 3.6 to webscrape. I have to open tabs / be able to toggle an "aria-expanded" in button tabs in order to access the div tabs I need. The button tab when the tab is closed is as follows with <> instead of --: button id="0-accordion-tab-0" type="button" class="accordion-panel-tit...
BeautifulSoup is used to parse HTML/XML content. You can't click around on a webpage with it. I recommend you look through the document to make sure it isn't just moving the content from one place to the other. If the content is loaded through AJAX when the button is clicked then you will have to use something like se...
0
false
1
5,566
2018-06-16 19:30:32.583
How to I close down a python server built using flask
When I run this simple code: from flask import Flask,render_template app = Flask(__name__) @app.route('/') def index(): return 'this is the homepage' if __name__ == "__main__": app.run(debug=True, host="0.0.0.0",port=8080) It works fine but when I close it using ctrl+z in the terminal and try to run it again I...
It stays alive because you're not closing it. With Ctrl+Z you're removing the execution from current terminal without killing a process. To stop the execution use Ctrl+C
0.201295
false
2
5,567
2018-06-16 19:30:32.583
How to I close down a python server built using flask
When I run this simple code: from flask import Flask,render_template app = Flask(__name__) @app.route('/') def index(): return 'this is the homepage' if __name__ == "__main__": app.run(debug=True, host="0.0.0.0",port=8080) It works fine but when I close it using ctrl+z in the terminal and try to run it again I...
You will have another process listening on port 8080. You can check to see what that is and kill it. You can find processes listening on ports with netstat -tulpn. Before you do that, check to make sure you don't have another terminal window open with the running instance.
-0.101688
false
2
5,567
2018-06-18 05:46:38.073
How to print all recieved post request include headers in python
I am a python newbie and i have a controler that get Post requests. I try to print to log file the request that it receive, i am able to print the body but how can i extract all the request include the headers? I am using request.POST.get() to get the body/data from the request. Thanks
request.POST should give you the POST body if it is get use request.GET if the request body is json use request.data
-0.201295
false
1
5,568
2018-06-18 09:08:56.737
Add conda to my environment variables or path?
I am having trouble adding conda to my environment variables on windows. I installed anaconda 3 though I didn't installed python, so neither pip or pip3 is working in my prompt. I viewed a few post online but I didn't find anything regarding how to add conda to my environment variables. I tried to create a PYTHONPATH ...
Thanks guys for helping me out. I solved the problem reinstalling anaconda (several times :[ ), cleaning every log and resetting the path variables via set path= in the windows power shell (since I got some problems reinstalling anaconda adding the folder to PATH[specifically "unable to load menus" or something like th...
0
false
1
5,569
2018-06-18 16:13:18.567
getting "invalid environment marker" when trying to install my python project
I'm trying to set up a beta environment on Heroku for my Django-based project, but when I install I am getting: error in cryptography setup command: Invalid environment marker: python_version < '3' I've done some googling, and it is suggested that I upgrade setuptools, but I can't figure out how to do that. (Putti...
The problem ended up being the Heroku "buildpack" that I was using. I had been using the one from "thenovices" for a long time so that I could use numpy, scipy, etc. Sadly, that buildpack specifies an old version of setuptools and python, and those versions were not understanding some of the new instructions (python...
1.2
true
1
5,570
2018-06-19 10:47:23.783
how to use the Werkzeug debugger in postman?
i am building a flask RESTapi and i am using postman to make http post requests to my api , i want to use the werkzeug debugger , but postman wont allow me to put in the debugging pin and debug the code from postman , what can i do ?
Never needed any debugger for postman. This is not the tool you need the long blanket of code for one endpoint to test. It gives a good option - console. I have never experienced any trouble this simple element didn't help me so far.
0
false
1
5,571
2018-06-19 13:14:35.270
Importing Numpy into Sublime Text 3
I'm new to coding and I have been learning it on Jupyter. I have anaconda, Sublime Text 3, and the numpy package installed on my Mac. On Jupyter, we would import numpy by simply typing import numpy as np However, this doesnt seem to work on Sublime as I get the error ModuleNotFoundError: No module named 'numpy' I ...
If you have Annaconda, install Spyder. If you continue to have this problem, you could check all the lib install from anaconda. I suggest you to install nmpy from anaconda.
0.386912
false
1
5,572
2018-06-19 18:36:14.277
dataframe from underlying script not updating
I have a script called "RiskTemplate.py" which generates a pandas dataframe consisting of 156 columns. I created two additional columns which gives me a total count of 158 columns. However, when I run this "RiskTemplate.py" script in another script using the below code, the dataframe only pulls the original 156 colum...
I figured it out, sorry for the confusion. I did not save the risktemplate that I updated the dataframe to in the same folder that the other reference script was looking at! Newbie!
0.386912
false
1
5,573
2018-06-20 01:59:58.440
Python regex to match words not having dot
I want to accept only those strings having the pattern 'wild.flower', 'pink.flower',...i.e any word preceding '.flower', but the word should not contain dot. For example, "pink.blue.flower" is unacceptable. Can anyone help how to do this in python using regex?
Your case of pink.blue.flower is unclear. There are 2 possibilities: Match only blue (cut off preceding dot and what was before). Reject this case altogether (you want to match a word preceding .flower only if it is not preceded with a dot). In the first case accept other answers. But if you want the second solution,...
0
false
2
5,574
2018-06-20 01:59:58.440
Python regex to match words not having dot
I want to accept only those strings having the pattern 'wild.flower', 'pink.flower',...i.e any word preceding '.flower', but the word should not contain dot. For example, "pink.blue.flower" is unacceptable. Can anyone help how to do this in python using regex?
You are looking for "^\w+\.flower$".
0.16183
false
2
5,574
2018-06-20 07:09:48.600
Conda package unavailable for my OS
I am trying to reproduce the results of someone else's Python code for a project. I have the entire setup - conda on my machine, the virtual environment .yml file, the relevant packages, and the data. However, the code relies on one package from the conda repo that is only available for Linux, and not MacOS. I'm confu...
I suggest you to try to install it using pip / pip3. Create your conda environment, here's a random example: conda -create -n ENVIRONMENTNAME python=3.6 numpy pandas and then... If you are using Python2: pip install tfbio If you are using Pyton3: pip3 install tfbio
1.2
true
1
5,575
2018-06-20 13:27:49.297
Unable to import sikuli library in RIDE
I have to write automation scripts using python and Robot framework. I have installed python, Robotframework, RIDE, wxpython. I have installed sikuli library but when I import it in my project, library is not imported. I have tried 'Import Library Spec XML'. My question is from where do I import this .xml or how do I c...
First check whether Sikuli is installed in python directory's \Lib\site-packages. Robot test should contain as below: * Settings * Documentation Sikuli Library Demo Library SikuliLibrary mode=NEW * Test Cases * Sample_Sikuli_Test blabh blabh etc
0
false
1
5,576
2018-06-21 01:45:25.967
Python: Reading Excel and automatically turning a string into a Date object?
I'm using the openpyxl library in Python and I'm trying to read in the value of a cell. The cells value is a date in the format MM/DD/YYYY. I would like for the value to be read into my script simply as a string (i.e. "8/6/2014"), but instead Python is somehow automatically reading it as a date object (Result is "2014-...
I would suggest changing it in your Excel if you want to preserve what is being read in by openpyxl. That said, when a cell has been formatted to a date in Excel, it becomes altered to fit a specified format so you've lost the initial string format in either case. For example, let's say that the user enters the date 1/...
0.386912
false
1
5,577
2018-06-21 13:37:54.770
How to handle exceptions in Robot Framework?
I want to understand how Exception Handling is done in Robot. I want to handle exceptions from multiple testcases using some generic way.
You can use below two keywords for that: Run Keyword And Continue On Failure Run Keyword And Ignore Error based on ur requirement, however i suggest to go with 2nd one as you'll be able to store output and status
0
false
1
5,578
2018-06-22 13:28:57.437
How to send ACK with data payload using python
I am trying to send an ACK with a data payload using the socket library but I cannot understand how to do it. Is this supported and if not, what are the alternatives?
you can't do this , Socket library uses high level APIs like : bind() listen() accept() ... etc the acks will be handled for you ,
0
false
1
5,579
2018-06-22 17:43:54.400
module can't be installed in Django virtual environment
I used pip install django-celeryand pip3 install django-celery in Pycharm. After that I use import djcelery,but Pycharm reminds me no module named djcelery. Then I used pip list I can see django-celery 3.2.2 in the list. But when I went to virtual environment path myenv/lib/site-packages where I can see all ...
Seems like you've installed django-celery in another environment. Try to install it with PyCharm: File > Settings > Project > Project Interpreter.
1.2
true
1
5,580
2018-06-22 18:41:42.363
Getting IDs from t-SNE plot?
Quite simple, If I perform t-SNE in Python for high-dimensional data then I get 2 or 3 coordinates that reflect each new point. But how do I map these to the original IDs? One way that I can think of is if the indices are kept fixed the entire time, then I can do: Pick a point in t-SNE See what row it was in t-SNE...
If you are using sklearn's t-SNE, then your assumption is correct. The ordering of the inputs match the ordering of the outputs. So if you do y=TSNE(n_components=n).fit_transform(x) then y and x will be in the same order so y[7] will be the embedding of x[7]. You can trust scikit-learn that this will be the case.
0.386912
false
1
5,581
2018-06-22 19:56:07.460
how to print the first lines of a large XML?
I have this large XML file on my drive. The file is too large to be opened with sublimetext or other text editors. It is also too large to be loaded in memory by the regular XML parsers. Therefore, I dont even know what's inside of it! Is it just possible to "print" a few rows of the XML files (as if it was some sort ...
This is one of the few things I ever do on the command line: the "more" command is your friend. Just type more big.xml
0.135221
false
1
5,582
2018-06-25 05:26:40.297
Two python3 interpreters on win10 cause misunderstanding
I used win10. When I installed Visual Studio2017, I configure the Python3 environment. And then after half year I installed Anaconda(Python3) in another directory. Now I have two interpreters in different directories. Now, no matter in what IDE I code the codes, after I save it and double click it in the directory, t...
Just change the interpreter order of the python in the PATH is enough. If you want to use python further more, I suggest you to use virtual environment tools like pipenv to control your python interpreters and modules.
0
false
1
5,583
2018-06-25 07:13:06.080
How can I update Python version when working on JGRASP on mac os?
When I installed the new version of python 3.6.5, JGRASP was using the previous version, how can I use the new version on JGRASP?
By default, jGRASP will use the first "python" on the system path. The new version probably only exists as "python3". If that is the case, install jGRASP 2.0.5 Beta if you are using 2.0.4 or a 2.0.5 Alpha. Then, go to "Settings" > "Compiler Settings" > "Workspace", select language "Python" if not already selected, sel...
0
false
1
5,584
2018-06-25 13:30:47.293
Passing command line parameters to python script from html page
I have a html page with text box and submit button. When somebody enters data in text box and click submit, i have to pass that value to a python script which does some operation and print output. Can someone let me now how to achieve this. I did some research on stackoverflow/google but nothing conclusive. I have pyth...
Short answer: You can't just run a python script in the clients browser. It doesn't work that way. If you want to execute some python when the user does something, you will have to run a web app like the other answer suggested.
0
false
1
5,585
2018-06-26 09:53:17.980
How to uninstall (mini)conda entirely on Windows
I was surprised to be unable to find any information anywhere on the web on how to do this properly, but I suppose my surprise ought to be mitigated by the fact that normally this can be done via Microsoft's 'Add or Remove Programs' via the Control Panel. This option is not available to me at this time, since I had in...
Open the folder where you installed miniconda, and then search for uninstall.exe. Open that it will erase miniconda for you.
0.995055
false
1
5,586
2018-06-27 02:35:38.367
protobuf, and tensorflow installation, which version to choose
I already installed python3.5.2, tensorflow(with python3.5.2). I want to install protobuf now. However, protobuf supports python3.5.0; 3.5.1; and 3.6.0 I wonder which version should I install. My question is should I upgrade python3.5.2 to python3.6, or downgrade it to python3.5.1. I see some people are trying downgrad...
So it is version problem one google post says change python version to a more general version. I am not sure how to change python3.5.2 to python3.5.1 I just installed procobuf3.6 I hope it works
0
false
1
5,587
2018-06-27 06:09:44.330
How to Resume Python Script After System Reboot?
I'm still new to writing scripts with Python and would really appreciate some guidance. I'm wondering how to continue executing my Python script from where it left off after a system restart. The script essentially alternates between restarting and executing a task for example: restart the system, open an application a...
You could write your current progress to a file just before you reboot and read said file on Programm start. About the automatic restart of the script after reboot: you could have the script to put itself in the Autostart of your system and after everything is done remove itself from it.
0
false
1
5,588
2018-06-29 09:49:04.483
Incorrect UTC date in MongoDB Compass
I package my python (flask) application with docker. Within my app I'm generating UTC date with datetime library using datetime.utcnow(). Unfortunately, when I inspect saved data with MongoDB Compass the UTC date is offset two hours (to my local time zone). All my docker containers have time zone set to Etc/UTC. Morove...
Finally, after trying to prove myself wrong, and hairless head I found the cause and solution for my problem. We are living in the world of illusion and what you see is not what you get!!!. I decided to inspect my data over mongo shell client rather than MongoDB Compass GUI. I figure out that data that arrived to data...
1.2
true
1
5,589
2018-07-01 07:10:49.220
How to replace all string in all columns using pandas?
In pandas, how do I replace &amp; with '&' from all columns where &amp could be in any position in a string? For example, in column Title if there is a value 'Good &amp; bad', how do I replace it with 'Good & bad'?
Try this df['Title'] = titanic_df['Title'].replace("&amp;", "&")
0
false
1
5,590
2018-07-01 23:33:29.923
Binance API: how to get the USD as the quote asset
I'm wondering what the symbol is or if I am even able to get historical price data on BTC, ETH, etc. denominated in United States Dollars. right now when if I'm making a call to client such as: Client.get_symbol_info('BTCUSD') it returns nothing Does anyone have any idea how to get this info? Thanks!
You can not make trades in Binance with dollars but instead with Tether(USDT) that is a cryptocurrency that is backed 1-to-1 with dollar. To solve that use BTCUSDT Change BTCUSD to BTCUSDT
0.995055
false
1
5,591
2018-07-02 10:22:40.247
How can i scale a thickness of a character in image using python OpenCV?
I created one task, where I have white background and black digits. I need to take the largest by thickness digit. I have made my picture bw, recognized all symbols, but I don't understand, how to scale thickness. I have tried arcLength(contours), but it gave me the largest by size. I have tried morphological operatio...
One possible solution that I can think of is to alternate erosion and find contours till you have only one contour left (that should be the thicker). This could work if the difference in thickness is enough, but I can also foresee many particular cases that can prevent a correct identification, so it depends very much ...
0.201295
false
1
5,592
2018-07-02 13:55:01.080
django inspectdb, how to write multiple table name during inspection
When I first execute this command it create model in my model.py but when I call it second time for another table in same model.py file then that second table replace model of first can anyone told the reason behind that because I am not able to find perfect solution for that? $ python manage.py inspectdb tablename > ...
python manage.py inspectdb table1 table2 table3... > app_name/models.py Apply this command for inspection of multiple tables of one database in django.
0
false
1
5,593
2018-07-02 17:04:29.297
Count Specific Values in Dataframe
If I had a column in a dataframe, and that column contained two possible categorical variables, how do I count how many times each variable appeared? So e.g, how do I count how many of the participants in the study were male or female? I've tried value_counts, groupby, len etc, but seem to be getting it wrong. Thanks
You could use len([x for x in df["Sex"] if x == "Male"). This iterates through the Sex column of your dataframe and determines whether an element is "Male" or not. If it is, it is appended to a list via list comprehension. The length of that list is the number of Males in your dataframe.
0
false
1
5,594
2018-07-03 17:27:42.043
Which newline character is in my CSV?
We receive a .tar.gz file from a client every day and I am rewriting our import process using SSIS. One of the first steps in my process is to unzip the .tar.gz file which I achieve via a Python script. After unzipping we are left with a number of CSV files which I then import into SQL Server. As an aside, I am loading...
Seeing that you have EmEditor, you can use EmEditor to find the eol character in two ways: Use View > Character Code Value... at the end of a line to display a dialog box showing information about the character at the current position. Go to View > Marks and turn on Newline Characters and CR and LF with Different Mark...
0
false
1
5,595
2018-07-03 18:21:44.653
Calling custom C subroutines in a Python application
I have two custom-written C routines that I would like to use as a part of a large Python application. I would prefer not to rewrite the C code in pure Python (or Cython, etc.), especially to maintain speed. What is the cleanest, easiest way that I can use my C code from my Python code? Or, what is the cleanest, easies...
Use cython to wrap your C code. In other words, create a CPython extension using Cython, that calls your C code.
1.2
true
1
5,596
2018-07-04 00:03:40.780
kubernetes architecture for microservices application - suggestions
I have been asked to create a system which has different functionalities. Assume service 1, service 2 and service 3. I need to run these services per hour to do something. To make the system of those services I need: database, web interface for seeing the result of the process, caching and etc. This is what I have tho...
For python/java applications, create docker images for both applications. If these application run forever to serve traffic then deploy them as deployments.If you need to have only cron like functionality, deploy as Job in kubernetes. To make services accessible, create services as selector for applications, so these ...
0.386912
false
1
5,597
2018-07-04 12:45:42.993
search_s search_ext_s search_s methods of python-ldap library doesn't return any Success response code
I am using search_ext_s() method of python-ldap to search results on the basis of filter_query, upon completion of search I get msg_id which I passed in result function like this ldap_object.result(msg_id) this returns tuple like this (100, attributes values) which is correct(I also tried result2, result3, result4 meth...
An LDAP server simply may not return any results, even if there was nothing wrong with the search operation sent by the client. With python-ldap you get an empty result list. Most times this is due to access control hiding directory content. In general the LDAP server won't tell you why it did not return results. (Ther...
1.2
true
1
5,598
2018-07-06 07:29:16.617
How to find dot product of two very large matrices to avoid memory error?
I am trying to learn ML using Kaggle datasets. In one of the problems (using Logistic regression) inputs and parameters matrices are of size (1110001, 8) & (2122640, 8) respectively. I am getting memory error while doing it in python. This would be same for any language I guess since it's too big. My question is how do...
I have tried many things. I will be mentioning these here, if anyone needs them in future: I had already cleaned up data like removing duplicates and irrelevant records depending on given problem etc. I have stored large matrices which hold mostly 0s as sparse matrix. I implemented the gradient descent using mini-b...
1.2
true
1
5,599
2018-07-06 17:58:05.770
Python Unit test debugging in VS code
I use VS code for my Python projects and we have unit tests written using Python's unittest module. I am facing a weird issue with debugging unit tests. VSCode Version: May 2018 (1.24) OS Version: Windows 10 Let's say I have 20 unit tests in a particular project. I run the tests by right clicking on a unit test file ...
This was a bug in Python extension for VS code and it is fixed now.
1.2
true
1
5,600
2018-07-08 23:33:21.993
Wondering how I can delete all of my python related files on Mac
So I was trying to install kivy, which lead me to install pip, and I went down a rabbit hole of altering directories. I am using PyCharm for the record. I would like to remove everything python related (including all libraries like pip) from my computer, and start fresh with empty directories, so when I download pychar...
If you are familiar with the Terminal app, you can use command lines to uninstall Python from your Mac. For this, follow these steps: Move Python to Trash. Open the Terminal app and type the following command line in the window: ~ alexa$ sudo rm -rf /Applications/Python\ 3.6/ It will require you to enter your adminis...
0.386912
false
1
5,601
2018-07-10 09:58:49.683
Lost artwork while converting .m4a to .mp3 (Python)
I'm trying to convert m4a audio file with artwork (cover) to mp3. I'm using ffmpeg to convert the audio. Once it copies, the artwork is lost. I'm quite not sure, how to retain the cover. I found some reference about mutagen library but not sure again how to use to copy the artwork. Any help would be great. ffmpeg -i s...
If anyone is having the same issue; I ended up reading the artwork from original file and attaching it back to mp3 if audioFileNameWithM4AExtension.startswith("covr"): #checks if it has cover cover = audioFileNameWithM4AExtension.tags['covr'][0] #gets the cover
0
false
1
5,602
2018-07-10 15:26:20.883
Use proxy sentences from cleaned data
Gensim's Word2Vec model takes as an input a list of lists with the inner list containing individual tokens/words of a sentence. As I understand Word2Vec is used to "quantify" the context of words within a text using vectors. I am currently dealing with a corpus of text that has already been split into individual toke...
That sounds like a reasonable solution. If you have access to data that is similar to your cleaned data you could get average sentence length from that data set. Otherwise, you could find other data in the language you are working with (from wikipedia or another source) and get average sentence length from there. Of co...
0.201295
false
1
5,603
2018-07-10 19:19:58.840
Python: ContextualVersionConflict: pandas 0.22.0; Requirement.parse('pandas<0.22,>=0.19'), {'scikit-survival'})
I have this issue: ContextualVersionConflict: (pandas 0.22.0 (...), Requirement.parse('pandas<0.22,>=0.19'), {'scikit-survival'}) I have even tried to uninstall pandas and install scikit-survival + dependencies via anaconda. But it still does not work.... Anyone with a suggestion on how to fix? Thanks!
Restarting jupyter notebook fixed it. But I am unsure why this would fix it?
0.999909
false
1
5,604
2018-07-11 15:01:09.260
How do I calculate the percentage of difference between two images using Python and OpenCV?
I am trying to write a program in Python (with OpenCV) that compares 2 images, shows the difference between them, and then informs the user of the percentage of difference between the images. I have already made it so it generates a .jpg showing the difference, but I can't figure out how to make it calculate a percent...
You will need to calculate this on your own. You will need the count of diferent pixels and the size of your original image then a simple math: (diferentPixelsCount / (mainImage.width * mainImage.height))*100
0
false
1
5,605
2018-07-11 21:22:40.900
How to import 'cluster' and 'pylab' into Pycharm
I would like to use Pycharm to write some data science code and I am using Visual Studio Code and run it from terminal. But I would like to know if I could do it on Pycharm? I could not find some modules such as cluster and pylab on Pycharm? Anyone knows how I could import these modules into Pycharm?
Go to the Preferences Tab -> Project Interpreter, there's a + symbol that allows you to view and download packages. From there you should be able to find cluster and pylab and install them to PyCharm's interpreter. After that you can import them and run them in your scripts. Alternatively, you may switch the project's ...
0.135221
false
1
5,606
2018-07-14 17:06:41.383
Multiple Inputs for CNN: images and parameters, how to merge
I use Keras for a CNN and have two types of Inputs: Images of objects, and one or two more parameters describing the object (e.g. weight). How can I train my network with both data sources? Concatenation doesn't seem to work because the inputs have different dimensions. My idea was to concatenate the output of the imag...
You can use Concatenation layer to merge two inputs. Make sure you're converting multiple inputs into same shape; you can do this by adding additional Dense layer to either of your inputs, so that you can get equal length end layers. Use those same shape outputs in Concatenation layer.
1.2
true
1
5,607
2018-07-14 20:27:44.470
How to analyse the integrity of clustering with no ground truth labels?
I'm clustering data (trying out multiple algorithms) and trying to evaluate the coherence/integrity of the resulting clusters from each algorithm. I do not have any ground truth labels, which rules out quite a few metrics for analysing the performance. So far, I've been using Silhouette score as well as calinski harab...
Don't just rely on some heuristic, that someone proposed for a very different problem. Key to clustering is to carefully consider the problem that you are working on. What is the proper way of proposing the data? How to scale (or not scale)? How to measure the similarity of two records in a way that it quantifies somet...
0
false
1
5,608
2018-07-15 06:08:43.183
how to run python code in atom in a terminal?
I'm a beginner in programming and atom so when try to run my python code written in the atom in terminal I don't know how...i tried installing packages like run-in-terminal,platformio-ide-terminal but I don't know how to use them.
I would not try to do it using extensions. I would use the platformio-ide-terminal and just do it from the command line. Just type: Python script_name.py and it should run fine. Be sure you are in the same directory as your python script.
0.135221
false
3
5,609
2018-07-15 06:08:43.183
how to run python code in atom in a terminal?
I'm a beginner in programming and atom so when try to run my python code written in the atom in terminal I don't know how...i tried installing packages like run-in-terminal,platformio-ide-terminal but I don't know how to use them.
Save your Script as a .py file in a directory. Open the terminal and navigate to the directory containing your script using cd command. Run python <filename>.py if you are using python2 Run python3 <filename.py> if you are using python3
0.135221
false
3
5,609
2018-07-15 06:08:43.183
how to run python code in atom in a terminal?
I'm a beginner in programming and atom so when try to run my python code written in the atom in terminal I don't know how...i tried installing packages like run-in-terminal,platformio-ide-terminal but I don't know how to use them.
"python filename.py" should run your python code. If you wish to specifically run the program using python 3.6 then it would be "python3.6 filename.py".
0
false
3
5,609
2018-07-16 08:18:12.017
How to measure latency in paho-mqtt network
I'm trying measure the latency from my publisher to my subscriber in an MQTT network. I was hoping to use the on_message() function to measure how long this trip takes but its not clear to me whether this callback comes after the broker receives the message or after the subscriber receives it? Also does anyone else ha...
I was involved in similar kind of work where I was supposed measure the latency in wireless sensor networks. There are different ways to measure the latencies. If the subscriber and client are synchronized. Fill the payload with the time stamp value at the client and transmit this packet to subscriber. At the subscri...
0.545705
false
2
5,610
2018-07-16 08:18:12.017
How to measure latency in paho-mqtt network
I'm trying measure the latency from my publisher to my subscriber in an MQTT network. I was hoping to use the on_message() function to measure how long this trip takes but its not clear to me whether this callback comes after the broker receives the message or after the subscriber receives it? Also does anyone else ha...
on_message() is called on the subscriber when the message reaches the subscriber. One way to measure latency is to do a loop back publish in the same client e.g. Setup a client Subscribe to a given topic Publish a message to the topic and record the current (high resolution) timestamp. When on_message() is called reco...
0.386912
false
2
5,610
2018-07-16 13:07:02.643
Brief explanation on tensorflow object detection working mechanism
I've searched for working mechanism of tensorflow object detection in google. I've searched how tensorflow train models with dataset. It give me suggestion about how to implement rather than how it works. Can anyone explain how dataset are trained in fit into models?
You can't "simply" understand how Tensorflow works without a good background on Artificial Intelligence and Machine Learning. I suggest you start working on those topics. Tensorflow will get much easier to understand and to handle after that.
0
false
1
5,611
2018-07-16 16:38:23.357
fetch data from 3rd party API - Single Responsibility Principle in Django
What's the most elegant way to fetch data from an external API if I want to be faithful to the Single Responsibility Principle? Where/when exactly should it be made? Assuming I've got a POST /foo endpoint which after being called should somehow trigger a call to the external API and fetch/save some data from it in my l...
I usually add any external API calls into dedicated services.py module (same level as your models.py that you're planning to save results into or common app if any of the existing are not logically related) Inside that module you can use class called smth like MyExtarnalService and add all needed methods for fetching, ...
0
false
1
5,612
2018-07-16 18:35:21.250
What is the window length of moving average trend in seasonal.seasonal_decompose package?
I am using seasonal.seasonal_decompose in python. What is the window length of moving average trend in seasonal.seasonal_decompose package? Based on my results, I think it is 25. But how can I be sure? how can I change this window length?
I found the answer. The "freq" part defines the window of moving average. Still not sure how the program choose the window when we do not declare it.
0
false
1
5,613
2018-07-17 10:48:39.477
How to retrain model in graph (.pb)?
I have model saved in graph (.pb file). But now the model is inaccurate and I would like to develop it. I have pictures of additional data to learn, but I don't if it's possible or if it's how to do it? The result must be the modified of new data pb graph.
It's a good question. Actually it would be nice, if someone could explain how to do this. But in addition i can say you, that it would come to "catastrophic forgetting", so it wouldn't work out. You had to train all your data again. But anyway, i also would like to know that espacially for ssd, just for test reasons.
0.545705
false
1
5,614
2018-07-17 10:52:00.203
Django - how to send mail 5 days before event?
I'm Junior Django Dev. Got my first project. Doing quite well but senior dev that teaches me went on vacations.... I have a Task in my company to create a function that will remind all people in specyfic Group, 5 days before event by sending mail. There is a TournamentModel that contains a tournament_start_date for ins...
You can set this mail send function as cron job。You can schedule it by crontab or Celery if Your team has used it.
0.201295
false
1
5,615
2018-07-19 12:11:04.380
how to change vs code python extension's language?
My computer's system language is zh_cn, so the vs code python extension set the default language to chinese. But i want to change the language to english. I can't find the reference in the doc or on the internet. Anyone konws how to do it? Thank's for help PS: vs code's locale is alreay set to english.
You probably installed other python extensions for VSCode. Microsoft official python extension will follow the locale setting in user/workspace settings. Try uninstall other python extensions, you may see it changes to English.
0
false
2
5,616
2018-07-19 12:11:04.380
how to change vs code python extension's language?
My computer's system language is zh_cn, so the vs code python extension set the default language to chinese. But i want to change the language to english. I can't find the reference in the doc or on the internet. Anyone konws how to do it? Thank's for help PS: vs code's locale is alreay set to english.
When VScode is open go to View menu and select Command Palette. Once the command palette is open type display in the box. This should display the message configure display language. Open that and you should be in a local.json file. The variable local should be set to en for English.
0
false
2
5,616
2018-07-19 19:12:26.090
Python3 remove multiple hyphenations from a german string
I'm currently working on a neural network that evaluates students' answers to exam questions. Therefore, preprocessing the corpora for a Word2Vec network is needed. Hyphenation in german texts is quite common. There are mainly two different types of hyphenation: 1) End of line: The text reaches the end of the line so...
It's surely possible, as the pattern seems fairly regular. (Something vaguely analogous is sometimes seen in English. For example: The new requirements applied to under-, over-, and average-performing employees.) The rule seems to be roughly, "when you see word-fragments with a trailing hyphen, and then an und, look fo...
0.386912
false
1
5,617
2018-07-20 10:26:17.870
Can't install tensorflow with pip or anaconda
Does anyone know how to properly install tensorflow on Windows? I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu" error I tried installing using p...
Tensorflow or Tensorflow-gpu is supported only for 3.5.X versions of Python. Try installing with any Python 3.5.X version. This should fix your problem.
1.2
true
5
5,618
2018-07-20 10:26:17.870
Can't install tensorflow with pip or anaconda
Does anyone know how to properly install tensorflow on Windows? I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu" error I tried installing using p...
You mentioned Anaconda. Do you run your python through there? If so check in Anaconda Navigator --> Environments, if your current environment have got tensorflow installed. If not, install tensorflow and run from that environment. Should work.
0
false
5
5,618
2018-07-20 10:26:17.870
Can't install tensorflow with pip or anaconda
Does anyone know how to properly install tensorflow on Windows? I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu" error I tried installing using p...
As of July 2019, I have installed it on python 3.7.3 using py -3 -m pip install tensorflow-gpu py -3 in my installation selects the version 3.7.3. The installation can also fail if the python installation is not 64 bit. Install a 64 bit version first.
0
false
5
5,618
2018-07-20 10:26:17.870
Can't install tensorflow with pip or anaconda
Does anyone know how to properly install tensorflow on Windows? I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu" error I tried installing using p...
Actually the easiest way to install tensorflow is: install python 3.5 (not 3.6 or 3.7) you can check wich version you have by typing "python" in the cmd. When you install it check in the options that you install pip with it and you add it to variables environnement. When its done just go into the cmd and tipe "pip inst...
0
false
5
5,618
2018-07-20 10:26:17.870
Can't install tensorflow with pip or anaconda
Does anyone know how to properly install tensorflow on Windows? I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu" error I tried installing using p...
Not Enabling the Long Paths can be the potential problem.To solve that, Steps include: Go to Registry Editor on the Windows Laptop Find the key "HKEY_LOCAL_MACHINE"->"SYSTEM"->"CurrentControlSet"-> "File System"->"LongPathsEnabled" then double click on that option and change the value from 0 to 1. 3.Now try to inst...
0
false
5
5,618
2018-07-21 10:12:24.710
Chatterbot dynamic training
I'm using chatter bot for implementing chat bot. I want Chatterbot to training the data set dynamically. Whenever I run my code it should train itself from the beginning, because I require new data for every person who'll chat with my bot. So how can I achieve this in python3 and on windows platform ? what I want to ...
I got the solution for that, I just deleted the data base on the beginning of the program thus new data base will create during the execution of the program. I used the following command to delete the data base import os os.remove("database_name") in my case import os os.remove("db.sqlite3") thank you
0
false
1
5,619
2018-07-21 11:51:55.627
How do I use Google Cloud API's via Anaconda Spyder?
I am pretty new to Python in general and recently started messing with the Google Cloud environment, specifically with the Natural Language API. One thing that I just cant grasp is how do I make use of this environment, running scripts that use this API or any API from my local PC in this case my Anaconda Spyder enviro...
First install the API by pip install or conda install in the scripts directory of anaconda and then simply import it into your code and start coding.
-0.201295
false
1
5,620
2018-07-21 16:20:50.893
How to open/create images in Python without using external modules
I have a python script which opens an image file (.png or .ppm) using OpenCV, then loads all the RGB values into a multidimensional Python array (or list), performs some pixel by pixel calculations solely on the Python array (OpenCV is not used at all for this stage), then uses the newly created array (containing new R...
Working with bare-bones .ppm files is trivial: you have three lines of text (P6, "width height", 255), and then you have the 3*width*height bytes of RGB. As long as you don't need more complicated variants of the .ppm format, you can write a loader and a saver in 5 lines of code each.
0.101688
false
1
5,621
2018-07-22 01:51:12.200
How run my code in spyder as i used to run it in linux terminal
Apologies if my question is stupid. I am a newbie is all aspects. I used to run my python code straight from the terminal in Linux Ubuntu, e.g. I just open the terminal go to my folder and run my command in my Linux terminal CUDA_VISIBLE_DEVICES=0 python trainval_net.py --dataset pascal_voc --net resnet101 --epochs ...
Okay I figured it out. I need to go to run->configure per file and in the command line options put the configuration (--dataset pascal_voc --net resnet101 --epochs 7 --bs 1 --nw 4 --lr 1e-3 --lr_decay_step 5 --cuda)
0
false
1
5,622
2018-07-22 04:44:09.413
How to use Midiutil to add multiple notes in one timespot (or how to add chords)
I am using Midiutil to recreate a modified Bach contrapuntist melody and I am having difficulty finding a method for creating chords using Midiutil in python. Does anyone know a way to create chords using Midiuitl or if there is a way to create chords.
A chord consists of multiple notes. Just add multiple notes with the same timestamp.
1.2
true
1
5,623
2018-07-22 16:11:22.640
PyCharm, stop the console from clearing every time you run the program
So I have just switched over from Spyder to PyCharm. In Spyder, each time you run the program, the console just gets added to, not cleared. This was very useful because I could look through the console to see how my changes to the code were changing the outputs of the program (obviously the console had a maximum length...
In Spyder the output is there because you are running iPython. In PyCharm you can get the same by pressing on View -> Scientific Mode. Then every time you run you see a the new output and the history there.
0.386912
false
1
5,624
2018-07-23 00:44:09.343
dateutil 2.5.0 is the minimum required version
I'm running the jupyter notebook (Enthought Canopy python distribution 2.7) on Mac OSX (v 10.13.6). When I try to import pandas (import pandas as pd), I am getting the complaint: ImportError: dateutil 2.5.0 is the minimum required version. I have these package versions: Canopy version 2.1.3.3542 (64 bit) jupyter vers...
The issue is with the pandas lib downgrade using the command below pip install pandas==0.22.0
0
false
3
5,625
2018-07-23 00:44:09.343
dateutil 2.5.0 is the minimum required version
I'm running the jupyter notebook (Enthought Canopy python distribution 2.7) on Mac OSX (v 10.13.6). When I try to import pandas (import pandas as pd), I am getting the complaint: ImportError: dateutil 2.5.0 is the minimum required version. I have these package versions: Canopy version 2.1.3.3542 (64 bit) jupyter vers...
I had this same issue using the newest pandas version - downgrading to pandas 0.22.0 fixes the problem. pip install pandas==0.22.0
0.240117
false
3
5,625
2018-07-23 00:44:09.343
dateutil 2.5.0 is the minimum required version
I'm running the jupyter notebook (Enthought Canopy python distribution 2.7) on Mac OSX (v 10.13.6). When I try to import pandas (import pandas as pd), I am getting the complaint: ImportError: dateutil 2.5.0 is the minimum required version. I have these package versions: Canopy version 2.1.3.3542 (64 bit) jupyter vers...
Installed Canopy version 2.1.9. The downloaded version worked without updating any of the packages called out by the Canopy Package Manager. Updated all the packages, but then the "import pandas as pd" failed when using the jupyter notebook. Downgraded the notebook package from 4.4.1-5 to 4.4.1-4 which cascaded to 3...
0
false
3
5,625
2018-07-23 17:57:30.150
CNN image extraction to predict a continuous value
I have images of vehicles . I need to predict the price of the vehicle based on image extraction. What I have learnt is , I can use CNN to extract the image features but what I am not able to get is, How to predict the prices of vehicles. I know that the I need to train my CNN model before it predicts the price. I d...
I would use the CNN to predict the model of the car and then using a list of all the car prices it's easy enough to get the price, or if you dont care about the car model just use the prices as lables
0
false
1
5,626
2018-07-24 11:59:30.057
How can I handle Pepper robot shutdown event?
I need to handle the event when the shutdown process is started(for example with long press the robot's chest button or when the battery is critically low). The problem is that I didn't find a way to handle the shutdown/poweroff event. Do you have any idea how this can be done in some convenient way?
Unfortunately this won't be possible as when you trigger a shutdown naoqi will exit as well and destroy your service. If you are coding in c++ you could use a destructor, but there is no proper equivalent for python... An alternative would be to execute some code when your script exits whatever the reason. For this y...
1.2
true
1
5,627
2018-07-24 16:25:19.637
Python - pandas / openpyxl: Tips on Automating Reports (Moving Away from VBA).
I currently have macros set up to automate all my reports. However, some of my macros can take up to 5-10 minutes due to the size of my data. I have been moving away from Excel/VBA to Python/pandas for data analysis and manipulation. I still use excel for data visualization (i.e., pivot tables). I would like to know ...
When using python to automate reports I fully converted the report from Excel to Pandas. I use pd.read_csv or pd.read_excel to read in the data, and export the fully formatted pivot tables into excel for viewing. doing the 'paste into a table and refresh' is not handled well by python in my experience, and will likely ...
0
false
1
5,628
2018-07-24 19:41:53.300
How to make RNN time-forecast multiple days using Keras?
I am currently working on a program that would take the previous 4000 days of stock data about a particular stock and predict the next 90 days of performance. The way I've elected to do this is with an RNN that makes use of LSTM layers to use the previous 90 days to predict the next day's performance (when training, th...
I don't have the rep to comment, but I'll say here that I've toyed with a similar task. One could use a sliding window approach for 90 days (I used 30, since 90 is pushing LSTM limits), then predict the price appreciation for next month (so your prediction is for a single value). @Digital-Thinking is generally right th...
0
false
1
5,629
2018-07-24 21:28:16.190
How do you setup script RELOAD/RESTART upon file changes using bash?
I have a Python Kafka worker run by a bash script in a Docker image inside a docker-compose setup that I need to reload and restart whenever a file in its directory changes, as I edit the code. Does anyone know how to accomplish this for a bash script? Please don't merge this with the several answers about running a sc...
My suggestion is to let docker start a wrapper script that simply starts the real script in the background. Then in an infinite loop: using inotifywait the wrapper waits for the appropriate change then kills/stop/reload/... the child process starts a new one in the background again.
1.2
true
1
5,630
2018-07-25 09:28:59.487
Creating an exe file for windows using mac for my Kivy app
I've created a kivy app that works perfectly as I desire. It's got a few files in a particular folder that it uses. For the life of me, I don't understand how to create an exe on mac. I know I can use pyinstaller but how do I create an exe from mac. Please help!
This is easy with Pyinstaller. I've used it recently. Install pyinstaller pip install pyinstaller Hit following command on terminal where file.py is path to your main file pyinstaller -w -F file.py Your exe will be created inside a folder dist NOTE : verified on windowns, not on mac
-0.386912
false
2
5,631
2018-07-25 09:28:59.487
Creating an exe file for windows using mac for my Kivy app
I've created a kivy app that works perfectly as I desire. It's got a few files in a particular folder that it uses. For the life of me, I don't understand how to create an exe on mac. I know I can use pyinstaller but how do I create an exe from mac. Please help!
For pyinstaller, they have stated that packaging Windows binaries while running under OS X is NOT supported, and recommended to use Wine for this. Can I package Windows binaries while running under Linux? No, this is not supported. Please use Wine for this, PyInstaller runs fine in Wine. You may also want to have ...
0.201295
false
2
5,631
2018-07-25 12:50:07.533
Python Redis on Heroku reached max clients
I am writing a server with multiple gunicorn workers and want to let them all have access to a specific variable. I'm using Redis to do this(it's in RAM, so it's fast, right?) but every GET or SET request adds another client. I'm performing maybe ~150 requests per second, so it quickly reaches the 25 connection limit ...
Most likely, your script creates a new connection for each request. But each worker should create it once and use forever. Which framework are you using? It should have some documentation about how to configure Redis for your webapp. P.S. Redis is a good choice to handle that :)
0
false
1
5,632
2018-07-25 18:37:23.550
Async HTTP server with scrapy and mongodb in python
I am basically trying to start an HTTP server which will respond with content from a website which I can crawl using Scrapy. In order to start crawling the website I need to login to it and to do so I need to access a DB with credentials and such. The main issue here is that I need everything to be fully asynchronous a...
Is there any way to make pymongo asynchronous with twisted No. pymongo is designed as a synchronous library, and there is no way you can make it asynchronous without basically rewriting it (you could use threads or processes, but that is not what you asked, also you can run into issues with thread-safeness of the code...
1.2
true
1
5,633
2018-07-25 21:15:26.713
Python: How to plot an array of y values for one x value in python
I am trying to plot an array of temperatures for different location during one day in python and want it to be graphed in the format (time, temperature_array). I am using matplotlib and currently only know how to graph 1 y value for an x value. The temperature code looks like this: Temperatures = [[Temp_array0] [Temp_a...
You can simply repeat the X values which are common for y values Suppose [x,x,x,x],[y1,y2,y3,y4]
0
false
1
5,634
2018-07-26 21:21:24.690
Triggering email out of Spotfire based on conditions
Does anyone have experience with triggering an email from Spotfire based on a condition? Say, a sales figure falls below a certain threshold and an email gets sent to the appropriate distribution list. I want to know how involved this would be to do. I know that it can be done using an iron python script, but I'm curio...
we actually have a product that does exactly this called the Spotfire Alerting Tool. it functions off of Automation Services and allows you to configure various thresholds for any metrics in the analysis, and then can notify users via email or even SMS. of course there is the possibility of coding this yourself (the to...
0.386912
false
1
5,635
2018-07-27 00:49:39.630
Scipy interp2d function produces z = f(x,y), I would like to solve for x
I am using the 2d interpolation function in scipy to smooth a 2d image. As I understand it, interpolate will return z = f(x,y). What I want to do is find x with known values of y and z. I tried something like this; f = interp2d(x,y,z) index = (np.abs(f(:,y) - z)).argmin() However the interp2d object does not work th...
I was able to figure this out. yvalue, zvalue, xmin, and xmax are known values. By creating a linspace out of the possible values x can take on, a list can be created with all of the corresponding function values. Then using argmin() we can find the closest value in the list to the known z value. f = interp2d(x,y,...
0
false
1
5,636
2018-07-27 04:42:13.823
How to set an start solution in Gurobi, when only objective function is known?
I have a minimization problem, that is modeled to be solved in Gurobi, via python. Besides, I can calculate a "good" initial solution for the problem separately, that can be used as an upper bound for the problem. What I want to do is to set Gurobi use this upper bound, to enhance its efficiency. I mean, if this upper ...
I think that if you can calculate a good solution, you can also know some bound for your variable even you dont have the solution exactly ?
0
false
1
5,637
2018-07-28 15:56:50.503
Many to many relationship SQLite (studio or sql)
Hellow. It seems to me that I just don't understand something quite obvios in databases. So, we have an author that write books and have books themselves. One author can write many books as well as one book could be written by many authors. Thus, we have two tables 'Books' and 'Authors'. In 'Authors' I have an 'ID'(...
You should have third intermediate table which will have following columns: id (primary) author id (from Authors table) book id (from Books table) This way you will be able to create a record which will map 1 author to 1 book. So you can have following records: 1 ... Author1ID ... Book1ID 2 ... Author1ID ... Book2ID...
1.2
true
1
5,638