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
2017-08-04 13:28:18.570
Best way to automate file names of multiple databases
I have to SSH into 120 machines and make a dump of a table in databases and export this back on to my local machine every day, (same database structure for all 120 databases). There isn't a field in the database that I can extract the name from to be able to identify which one it comes from, it's vital that it can be i...
You can try to modify your command as follow: mysql -uroot -p{your_password} -e 'SELECT * FROM dfs_va2.artikel_trigger;' > /Users/admin/Documents/dbdump/$(hostname)_dump.csv" download:"/Users/johnc/Documents/Imports/$(hostname)_dump.csv" hostname returns current machine name so all your files should be unique (of cou...
0
false
1
5,029
2017-08-04 18:17:05.603
Real-life module reloading in Python?
I am going through a book on Python which spends a decent time on module reloading, but does not explain well when it would be useful. Hence, I am wondering, what are some real-life examples of when such technique becomes handy? That is, I understand what reloading does. I am trying to understand how one would use it ...
As an appendix to DYZ's answer, I use module reloading when analysing large data in interactive Python interpreter. Loading and preprocessing of the data takes some time and I prefer to keep them in the memory (in a module BTW) rather than restart the interpreter every time I change something in my modules.
0
false
1
5,030
2017-08-05 01:40:54.807
How to get all files like: js,css,images from a website to save it for offline use?
I am not talking about the softwares like surf online, HTtrack, or any other 'save page' feature of browsers but I need to know how actually it happens in the background. I am interested in making my own program to do that. Also is it possible to do in JavaScript. If yes what are the libraries I should look into or any...
Download entire HTML content of the web page For JS files, look for the <script> tags and download the js file using the src attribute or any inline scripts inside the tag For CSS, use <link> tag to download the CSS file and also look for any <style> tags for inline CSS styling For Images, scan for <img> tag and downl...
1.2
true
1
5,031
2017-08-05 06:05:23.353
expiry date in odoo 10
How to calculate expiry date in odoo 10 and how to notify to customers from email/sms before 10 days? for example:- If expiry date is near, the customer gets notification through mail or sms. Can anyone suggest any solution?
You need to create a scheduler it should run everyday. It should calculate the expiry dates which are ending in next 10 days. For those records you have to trigger the mail. Create a scheduler Find the expiry dates Create email template Trigger Email Please refer sale subscription it has subscription expiry reminder
0.386912
false
1
5,032
2017-08-06 00:18:47.823
Failing to install sqlite3 plugin for electron project on windows
I am trying to include sqlite3 in an electron project I am getting my hands dirty with. I have never used electron, nor Node before, excuse my ignorance. I understand that to do this on Windows, I need Python installed, I need to download sqlite3, and I need to install it. As per the NPM sqlite3 page, I am trying to i...
This has been resolved.... Uninstalled Python 2.7.13. Reinstalled, added path to PATH variable again, now command 'python' works just fine...
0
false
1
5,033
2017-08-06 11:23:11.447
NLTK FreqDist counting two words as one
I am having some trouble with NLTK's FreqDist. Let me give you some context first: I have built a web crawler that crawls webpages of companies selling wearable products (smartwatches etc.). I am then doing some linguistic analysis and for that analysis I am also using some NLTK functions - in this case FreqDist. nlt...
This is a well-known problem in NLP and it is often referred to Tokenization. I can think about two possible solutions: try different NLTK tokenizers (e.g. twitter tokenizer), which maybe will be able to cover all of your cases run a Name Entity Recognition (NER) on your sentences. This allows you to recognise entity ...
0
false
1
5,034
2017-08-07 00:35:55.990
Python have program running and ready for when called
To be clear I have no idea what I'm doing here and any help would be useful. I have a number of saved files, Keras neural network models and dataframes. I want to create a program that loads all of these files so that the data is there and waiting for when needed. Any data sent to the algorithm will be standardised and...
Wrap it in a Python based web server listening on some agreed-on port. Hit it with HTTP requests when you want to supply a new file or retrieve results.
0
false
1
5,035
2017-08-08 17:56:08.513
What format of path should be used for savefig?
I created a path variable for my project using proj_path = pathlib.Path('C:/users/data/lives/here') I now want to save a seaborn plot as png so I created a new path variable for the file plot_path = proj_path.joinpath('plot_name.png') but when I call plot_name.savefig(plot_path) returns TypeError: Object does not appe...
You probably want to use plot_name.savefig(plot_path) instead of plot_name.savefig('plot_path') (note no '-s).
0
false
1
5,036
2017-08-08 20:38:27.237
Print sample set of columns from dataframe in Pandas?
How do you print (in the terminal) a subset of columns from a pandas dataframe? I don't want to remove any columns from the dataframe; I just want to see a few columns in the terminal to get an idea of how the data is pulling through. Right now, I have print(df2.head(10)) which prints the first 10 rows of the datafram...
print(df2[['col1', 'col2', 'col3']].head(10)) will select the top 10 rows from columns 'col1', 'col2', and 'col3' from the dataframe without modifying the dataframe.
1
false
1
5,037
2017-08-09 23:10:43.900
Installing a command line utility from installing a python package
I am trying to make a python package that relies on a command line utility to work. I am wondering if anyone knows how to make pip install that command line utility when pip installs my package. The only documentation I can seem to find is on dependency_links which looks to be depreciated.
You can set dependencies on another python package (e.g. using install_requires in your setup.py), but if your code relies on a specific non-Python binary you cannot have that installed automatically as part of the pip install process. You could create a native package for your operating system, which would allow you ...
0
false
1
5,038
2017-08-10 08:36:04.583
how to seperate celery code into server and client side?
Imagine that I've written a celery task, and put the code to the server, however, when I want to send the task to the server, I need to reuse the code written before. So my question is that are there any methods to seperate the code between server and client.
Try a web server like flask that forwards requests to the celery workers. Or try a server that reads from a queue (SQS, AMQP,...) and does the same. No matter the solution you choose, you end up with 2 services: the celery worker itself and the "server" that calls the celery tasks. They both share the same code but are...
0
false
1
5,039
2017-08-10 11:22:35.980
running scheduled job in django app deployed on heroku
I have deployed a django app on heroku. So far it works fine. Now I have to schedule a task (its in the form of python script) once a day. The job would take the data from heroku database perform some calculations and post the results back in the database. I have looked at some solutions for this usually they are using...
I suggest you to create a Django management command for your project like python mananage.py run_this_once_a_day. And you can use Heroku schedular to trigger this scheduling.
0.386912
false
1
5,040
2017-08-11 02:12:53.293
Get width of child in tkinter
Say I have a Frame in tkinter with a set width and height (placed using the place method), and I add a child Frame to that parent Frame (using the pack method). In that child Frame, I add an arbitrary amount of widgets, so that the child Frame's width is dynamically set depending on its children. My question is how do ...
The width will never be bigger than the parent frame. You can call winfo_reqwidth to get the requested width of the widget. I'm not sure if that will give you the answer you are looking for. I'm not entirely what the real problem is that you are trying to solve.
1.2
true
1
5,041
2017-08-11 08:36:48.013
Exported scraped .csv file from AWS EC2 to AWS MYSQL database
I have a Python Scraper that I run periodically in my free tier AWS EC2 instance using Cron that outputs a csv file every day containing around 4-5000 rows with 8 columns. I have been ssh-ing into it from my home Ubuntu OS and adding the new data to a SQLite database which I can then use to extract the data I want. Now...
The problem is you don't have access to RDS filesystem, therefore cannot upload csv there (and import too). Modify your Python Scraper to connect to DB directly and insert data there.
0.201295
false
1
5,042
2017-08-11 12:07:01.330
PySerial, check if Serial is Connected
So I am working on a project that has a Raspberry Pi connected to a Serial Device via a USB to Serial Connector. I am trying to use PySerial to track the data being sent over the connected Serial device, however there is a problem. Currently, I have my project set up so that every 5 seconds it calls a custom port.open...
You might be able to tell whether the device is physically plugged in by checking the status of one of the RS232 control lines - CTS, DSR, RI, or CD (all of which are exposed as properties in PySerial). Not all USB-serial adapters support any of these. If the only connection to the device is the TX/RX lines, your choi...
0
false
1
5,043
2017-08-14 13:57:41.950
ModuleNotFoundError: No module named 'pyaudio'
I ran pip install pyaudio in my terminal and got this error: Command "/home/oliver/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ub9alt7s/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install...
if you are using windows then these command on the terminal: pip install pipwin pipwin install pyaudio
0
false
2
5,044
2017-08-14 13:57:41.950
ModuleNotFoundError: No module named 'pyaudio'
I ran pip install pyaudio in my terminal and got this error: Command "/home/oliver/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ub9alt7s/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install...
Check in the documentation of pyaudio if it is compatible with your python version Some modules which are not compatible may be installed without issues, yet still won't work when trying to access them
1.2
true
2
5,044
2017-08-15 07:22:37.923
Modifying and creating xlsx files with Python, specifically formatting single words of a e.g. sentence in a cell
I'm working a lot with Excel xlsx files which I convert using Python 3 into Pandas dataframes, wrangle the data using Pandas and finally write the modified data into xlsx files again. The files contain also text data which may be formatted. While most modifications (which I have done) have been pretty straight forward...
i have been recently working with openpyxl. Generally if one cell has the same style(font/color), you can get the style from cell.font: cell.font.bmeans bold andcell.font.i means italic, cell.font.color contains color object. but if the style is different within one cell, this cannot help. only some minor indication...
0
false
1
5,045
2017-08-16 11:09:38.680
Can I make an endless loop of python programs?
I was wondering how to make program1 run program2 and program2 run program1 and so on. I have already tried using os.system() on each program to run the other, but a really long line of errors comes up and says maximum recursion depth reached Thanks
Except the weirdness of the question :) What you did is a correct way, but each time you call a new program your stack gets bigger and after a while your stack is full and you get a stack overflow (no you don't get this site :p ), but just an error which this site is named after as you encountered. If you really want t...
1.2
true
1
5,046
2017-08-17 01:51:04.757
How can i obtain Camera Matrix in 3Dreconstruction?
I want to achieve a 3D-reconstruction algorithm with sfm, But how should i set the parameters of the Camera Matrix? I have double cameras,both know their focal length. And how about Rotation Matrix and Translation Matrix from world view? i use python
You already have a code for camera calibration and printing a camera matrix in your OpenCV installation. Go to this path if you are on windows - C:\opencv\sources\samples\python There you have a file called calibrate
1.2
true
1
5,047
2017-08-17 04:32:31.810
Questions about double install of Python on OSX
As we all know; Apple ship OSX with Python, but it locks it away. This force me and anyone else that use python, to install another version and start the painful process of installing with pip with 100 tricks and cheats. Now, I would like to understand how to do this right; and sorry but I can't go with the route of th...
Brew installs packages into /usr/local/Cellar and then links them to /usr/local/bin (i.e. /usr/local/bin/python3). In my case, I just make sure to have /usr/local/bin in my PATH prior to /usr/bin. export PATH=/usr/local/bin:$PATH By using brew, your new packages will be installed to: /usr/local/Cellar/python or /usr...
0
false
1
5,048
2017-08-17 09:47:58.883
When running " python mnist_with_summaries.py ", it has occurred the error
When running this example:" python mnist_with_summaries.py ", it has occurred the following error: detailed errors: Traceback (most recent call last): File "mnist_with_summaries.py", line 214, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "D:\ProgramData\Anaconda2\envs\Anaconda3\lib\site-...
I have solved this problem. I changed line 204 and line 210 of mnist_with_summaries.py to the local directories, and I created some folders. OR, don't change the code, and I created some folders in the local disk where is the running environment according to the code. line 204: create /tmp/tensorflow/mnist/input_dat...
0.386912
false
1
5,049
2017-08-17 14:11:17.810
Writing in parallel to MongoDb collection from python
I would like to know how to insert into same MongoDb collection from different python scripts running at the same time using pymongo any help redirecting guidance would be very appreciated because I couldn't find any clear documentation in pymongo or mongdb about it yet thank in advance
You should be able to just insert into the collection in parallel without needing to do anything special. If you are updating documents then you might find there are issues with locking, and depending on the storage engine which your MongoDB is using there may be collection locking, but this should not affect how you ...
1.2
true
1
5,050
2017-08-17 16:08:57.843
How to control MT4 from python?
I'm using a MetaTrader4 Terminal and I'm experienced python developer. Does anyone know, how can I connect MT4 and Python? I want to: - connect to MT4 - read USD/EUR data - make order (buy/sell) Does anyone know some library, a page with instructions or a documentation or have at least idea how to do that? I googled ...
Several options: exchange with files (write data from mt4 into a file for python, another folder in opposite direction with buy/sell instructions); 0MQ (or something like that) as a better option.
0.081452
false
1
5,051
2017-08-18 03:08:12.380
Add button next page - wizard - Odoo v8
I'm trying to create a wizard which has several pages. I know how to pass to 'target' new or current, to pass the action to a form or tree view, but what I actually need, before that, is to create several steps which will be on different "views" of this wizard, like a form with 'next' and 'back' buttons. Is there some ...
The best way to do this is to have a popup target=new and have a statusbar on top right which will be clickable/not readonly (so that the user can go back). And depending on the state of your record, show the appropriate fields You can of course create a popup, and when the user clicks next destroy that popup and creat...
1.2
true
1
5,052
2017-08-18 16:13:09.217
IPython - running a script with %run command - saved to which folder?
I'm in IPython and want to run a simple python script that I've saved in a file called "test.py". I'd like to use the %run test.py command to execute it inside IPython, but I don't know to which folder I need to save my test.py. Also, how can I change that default folder to something else, for example C:\Users\user\f...
%run myprogram works for Python scripts/programs. To run any arbitrary programs, use ! as a prefix, e.g. !myprogram. Many common shell commands/programs (cd, ls, less, ...) are also registered as IPython magic commands (run via %cd, %ls, ...), and also have registered aliases, so you can directly run them without any p...
0
false
1
5,053
2017-08-18 19:55:54.163
How can Python test the availability of a NAS drive really quickly?
For a flood warning system, my Raspberry Pi rings the bells in near-real-time but uses a NAS drive as a postbox to output data files to a PC for slower-time graphing and reporting, and to receive various input data files back. Python on the Pi takes precisely 10 seconds to establish that the NAS drive right next to it...
Taking on MQTT at this stage would be a big change to this nearly-finished project. But your suggestion of decoupling the near-real-time Python from the NAS drive by using a second script is I think the way to go. If the Python disc interface commands wait 10 seconds for an answer, I can't help that. But I can stop ...
0
false
1
5,054
2017-08-19 14:05:50.910
python: how to check the use of an external program
In Python, how do you check that an external program is running? I'd like to track my use of some programs, so I can see the amount of time I've spent with them. For example, if I launch my program , I want to be able to see if Chrome has already been launched, and if so, start a timer which would end when I exit Chrom...
In my case I would try something using Task Manager data, probably using subprocess.check_output(ps)(for me that looks good), but you can the [psutil][1] library. Tell us what you did later :)
0
false
1
5,055
2017-08-20 22:08:56.913
Runnning python script on HTML page
I would like to basically call a python script from HTML, after the script is called and it finished running, I would like to execute a javascript file(wich I know how to do.) Now my question is: Can I do this with just pure HTML and javascript or do I need to get a library for python? If I dont need a library, how wou...
You can use Two Python libraries. Django Flask I recommend Django. Django is easy and fast to make. the Flask is more complex but you can make more detail functions.
0
false
1
5,056
2017-08-21 17:28:08.920
Converting all files in folder to .py files
I was wondering if their is anyway to go through and make copies of each .ipynb file in a folder and then change that file to .py. I want to keep the .ipynb files but I would like to have a .py file as well. I know how to do it manually but would like a way to do it automatically for each file in a specified directory.
find . -name "*.py" -exec ipython nbconvert --to=python {} \; should work on Linux.
0.265586
false
1
5,057
2017-08-21 23:45:05.150
how to find out which Python is called when I run pytest via Jenkins
I am running pytest on a Jenkins machine; although I am not sure which Python it is actually running. The machine is running OSX; and I did install various libraries (like numpy and others), on top of another Python install via Brew, so I keep things separated. When I run the commands from console; I specify python2.6 ...
You can use which python to find which python Jenkins use. You can use ABSPATH/OF/python to run your pytest
0
false
1
5,058
2017-08-22 09:16:03.197
how to change matplotlibrc default directory
I'm currently using anaconda and python 3.6 on windows bash. Every time i want to use matplotlib I have to paste a copy of the matplotlibrc file into my working directory otherwise my code won't run or plot and I get the warning - /home/computer/anaconda3/lib/python3.6/site-packages/matplotlib/init.py:1022: UserWarning...
It looks like when anaconda or matplotlib was installed it's created the matplotlibrc file in C:\Users\user\AppData\Local\lxss\home\puter\anaconda3\lib\py‌​thon3.6\site-package‌​s\matplotlib\mpl-dat‌​a using the windows environment. This has caused the file not to be recognised in WSL. To fix this create another matplo...
1.2
true
1
5,059
2017-08-22 12:30:04.117
Python windows forms application
I want to do some applications with python, but I haven't found any way of getting a tool-box of buttons, check box, etc. Can some explain me please how can I do that with: 1. Pycharm. 2. If it is problem with Pycharm, visual studio community is also okay. Thanks, Ayal
This is what I have found: There is a designer from QT, to build a ui file. There is a tool for translating the ui into python. Then you can edit the logic, with any python tool. You only need PyQt the current version is PyQt5.
0
false
1
5,060
2017-08-22 16:03:09.047
How do you make a .tar.gz file of all your pip packages used in a project?
I was wondering how to make a .tar.gz file of all pip packages used in a project. The project will not have access to the internet when a user sets up the application. So, I though it would be easiest to create .tar.gz file that would contain an all the necessary packages and the user would just extract and install t...
Do: pip freeze > requirements.txt It will store all your requirements in file requirements.txt pip wheel -r requirements.txt --wheel-dir="packages" It will pre-package or bundle your dependencies into the directory packages Now you can turn-off your Wi-fi and install the dependencies when ever you want from the "pac...
0.201295
false
1
5,061
2017-08-22 23:36:12.213
Treepoem barcode generator unable to find ghostscript
I'm trying to generate a pdf417 barcode in python using treepoem but pycharm keeps giving me the following error: Traceback (most recent call last): File "C:/Users/./Documents/barcodes.py", line 175, in image = generate_barcode(barcode_type="pdf417",data=barcode, options=dict(eclevel=5, rows=27, columns=12)) Fil...
You are installing on Windows, the Windows binary differs in name from the Linux binaries and indeed differs depending whether you installed the 64 or 32-bit version. On Linux (and MacOS) the Ghostscript binary is called 'gs', on Windows its 'gswin32' or 'gswin64' or 'gswin32c' or 'gswin64c' depending on whether you w...
1.2
true
1
5,062
2017-08-23 11:32:22.457
How do I avoid a BrokenPipeError while using the sockets module in Python?
I'm writing a basic socket program in Python3, which consists of three different programs - sender.py, channel.py, and receiver.py. The sender should send a packet through the channel to the receiver, then receiver sends an acknowledgement packet back. It works for sending one packet - it goes through the channel to th...
It was because I was generating a new socket each time, rather than just re-using one socket.
1.2
true
1
5,063
2017-08-23 20:42:50.897
How to store a "set" (the python type) in a database efficiently?
I would like to store a "set" in a database (specifically PostgreSQL) efficiently, but I'm not sure how to do that efficiently. There are a few options that pop to mind: store as a list ({'first item', 2, 3.14}) in a text or binary column. This has the downside of requiring parsing when inserting into the database an...
What you want to do is store a one-to-many relationship between a row in your table and the members of the set. None of your solutions allow the members of the set to be queried by SQL. You can't do something like select * from mytable where 'first item' in myset. Instead you have to retrieve the text/blob and use anot...
0.386912
false
1
5,064
2017-08-24 10:37:56.670
How to produce kafka topic using message batch or buffer with pykafka
How to produce kafka topic using message batch or buffer with pykafka. I mean one producer can produce many message in one produce process. i know the concept using message batch or buffer message but i dont know how to implement it. I hope someone can help me here
Just use the send() method. You do not need to manage it by yourself. send() is asynchronous. When called it adds the record to a buffer of pending record sends and immediately returns. This allows the producer to batch together individual records for efficiency. Your task is only that configure two props about...
0
false
1
5,065
2017-08-24 15:10:53.587
Jupyter notebook display code only
I am using jupyter notebooks to write some explanations on how to use certain functions. The code i am showing there is not complete, meaning it will give errors when executed. Is there a way to write display-only code in a jupyter notebook?
You can use markdowns. Or you can put in comment your code but it will be not in "jupyter way"
0
false
1
5,066
2017-08-27 08:03:24.350
any Python IDE supports stopping in breakpoint from the debugger
I am looking for the following (IMHO, very important) feature: Suppose I have two functions fa() and fb(), both of them has a breakpoint. I am now stopped in the breakpoint in fa function. In the interactive debugger console I am calling fb(). I want to stop in fb breakpoint, but, unfortunately pb() runs but ignores ...
Take a look at Eric Python IDE and VSC(Visual Studio Code)
-0.201295
false
1
5,067
2017-08-28 04:43:27.403
How to put a Python script in the background without pythonw.exe?
I'm fairly new to Python and I have a python script that I would like to ultimately convert to a Windows executable (which I already know how to do). Is there a way I can write something in the script that would make it run as a background process in Windows instead of being visible in the foreground?
You can run the file using pythonw instead of python means run the command pythonw myscript.py instead of python myscript.py
0
false
1
5,068
2017-08-28 16:26:26.230
is it possible to scrape list of followers of a public twitter acount (page)
i am student and i am totally new to scraping etc, today my supervisor gave me task to get the list of followers of a user or page(celebrity etc) the list should contain information about every user (i.e user name, screen name etc) After a long search i found that i can't get the age and gender of any user on twitter. ...
Hardly so, and even if you manage to somehow do it, you'll most likely get blacklisted. Also, please read the community guidelines when it comes to posting questions.
0
false
1
5,069
2017-08-29 09:28:20.067
Airflow: Get user logged in with ldap
Does anyone know how I'll be able to get the current user from airflow? We have our backend enabled to airflow/contrib/auth/backends/ldap_auth.pyand so users log in via that authentication and I want to know how to get the current user that clicks on something (a custom view we have as a plugin).
You can get it by calling {{ current_user.user.username }} or {{ current_user.user }} in your html jenja template.
1.2
true
1
5,070
2017-08-29 15:22:24.293
Bekeley caffe command line interface
if you are using a custom python layer - and assuming you wrote the class correctly in python - let's say the name of the class is "my_ugly_custom_layer"; and you execute caffe in the linux command line interface, how do you make sure that caffe knows how to find the file where you wrote the class for your layer? do y...
Your python layer has two parameters in the prototxt: layer: where you define the python class name implementing your layer, and moduule: where you define the .py file name where the layer class is implemented. When you run caffe (either from command line or via python interface) you need to make sure your module is in...
1.2
true
1
5,071
2017-08-29 20:01:48.123
Django: how can i get a model that store a list(like in python or anyway) of a sizes of a shoes
excuse my English I'm beginner in django and i want to achieve this in my model and form: the scenario is like purchasing shoes on amazon: 1. the shoes has list of size a user can select form 2. the user select and add it to the cart 3. user place an order which is saved in a model with the respective size included n...
You can convert the list to json and store it in a charfield.
0
false
1
5,072
2017-08-30 11:58:18.193
Vue.JS on top of existing python/django/jinja app for filter and list render
I have an existing python/django app with jinja template engine. I have a template with a filter and a list the gets rendered correctly via server, also the filters work perfectly without javascript. (based on url with parameters) The server also responds with json if the same filter url is requested by ajax. So it's r...
I think the best method really is to split up the front and backend into two seperate entities, communicating via an API rather than bleeding the two together as in the long run it creates headaches.
-0.386912
false
1
5,073
2017-09-01 09:50:49.070
Install Python version 3 side by side with version 2 in Centos 7
I have a CentOS 7 machine which already has Python 2.7.5 installed. Now i want to install Python version 3 also side by side without disturbing the original Python version 2. If i install with pip i fear that it would install version 3 on top of the already existing version. Can someone please guide me how to do the s...
You can simply apt-get install python3 and then use -p python3 while creating your virtual environment. Installing python3 will not disturb your system python (2.7).
-0.470104
false
1
5,074
2017-09-02 08:08:31.797
How to do superscripts and subscripts in Jupyter Notebook?
I want to to use numbers to indicate references in footnotes, so I was wondering inside of Jupyter Notebook how can I use superscripts and subscripts?
<sup>superscript text </sup> also works, and might be better because latex formatting changes the whole line etc.
1
false
1
5,075
2017-09-02 18:14:43.557
How can I convert '?' to NaN
I have a dataset and there are missing values which are encoded as ?. My problem is how can I change the missing values, ?, to NaN? So I can drop any row with NaN. Can I just use .replace() ?
You can also do like this, df[df == '?'] = np.nan
0.101688
false
2
5,076
2017-09-02 18:14:43.557
How can I convert '?' to NaN
I have a dataset and there are missing values which are encoded as ?. My problem is how can I change the missing values, ?, to NaN? So I can drop any row with NaN. Can I just use .replace() ?
You can also read the data initially by passing df = pd.read_csv('filename',na_values = '?') It will automatically replace '?' to NaN
0.201295
false
2
5,076
2017-09-02 22:37:27.403
Keep Google Cloud Jupyter Notebook Running while computer sleeps
So I want to run a neural network on Google Cloud instance, but whenever my computer goes to sleep the notebook seems to stop running. Does anyone know how I can keep it running?
In the remote (GCP) SSH client: Install tmux: sudo apt-get install tmux. Start a new tmux session: tmux new -s "session". Run commands as normal.
0
false
3
5,077
2017-09-02 22:37:27.403
Keep Google Cloud Jupyter Notebook Running while computer sleeps
So I want to run a neural network on Google Cloud instance, but whenever my computer goes to sleep the notebook seems to stop running. Does anyone know how I can keep it running?
I know it's an old question but let me give it a shot. When you say Google Cloud instance do you mean their compute engine (virtual machine)? If so, you don't need to keep your laptop running all the time to continue a process on cloud, there is an alternative. You can run your python programs from terminal and use too...
0
false
3
5,077
2017-09-02 22:37:27.403
Keep Google Cloud Jupyter Notebook Running while computer sleeps
So I want to run a neural network on Google Cloud instance, but whenever my computer goes to sleep the notebook seems to stop running. Does anyone know how I can keep it running?
I just discovered this huge oversight in GCP. I don't understand how they could design it this way. This behavior defeats a major point of using the cloud. They want us to pay for this? I use a laptop which sometimes needs to be asleep in a backpack, I can't keep a computer on all day just so a cloud computer can run. ...
0.265586
false
3
5,077
2017-09-03 14:34:16.643
I want to make a cronjob such that it runs a python script every second
I tried making a cronjob to run my script every second, i used */60 * * * * this a parameter to run every second but it didn't worked, pls suggest me how should i run my script every second ?
Well, no. Your argument - */60 * * * * - means "run every 60 minutes". And you can't specify a shorter interval than 1 minute, not in standard Unix cron anyway.
1.2
true
1
5,078
2017-09-03 21:51:38.560
Making a 32 bit .exe from PyInstaller using PyCharm
I have a 64 bit PC, and python 3.6.2 (64 bit), python 3.5.4 (32 bit), and python 3.5.4 (64 bit), all installed and added to my path. In Pycharm, I created a virtual environment based off of python 3.5.4 (32 bit) and wrote a project in this env. Each version of python I have installed has an associated virtual env, and ...
It seems like your Pyinstaller is using the wrong version of Python, to make it use the correct one you probably want to use an explicit declaration of what Python interpreter you're using. It's normally something like python -m pyinstaller {args} but other ones could be python3.5 I'd recommend using a virtual environ...
1.2
true
1
5,079
2017-09-04 13:59:50.270
how to prepare image dataset for training model?
I have a project that use Deep CNN to classify parking lot. My idea is to classify every space whether there is a car or not. and my question is, how do i prepare my image dataset to train my model ? i have downloaded PKLot dataset for training included negative and positive image. should i turn all my data training im...
as you want use pklot dataset for training your machine and test with real data, the best approach is to make both datasets similar and homological, they must be normalized , fixed sized , gray-scaled and parameterized shapes. then you can use Scale-invariant feature transform (SIFT) for image feature extraction as ba...
0.135221
false
2
5,080
2017-09-04 13:59:50.270
how to prepare image dataset for training model?
I have a project that use Deep CNN to classify parking lot. My idea is to classify every space whether there is a car or not. and my question is, how do i prepare my image dataset to train my model ? i have downloaded PKLot dataset for training included negative and positive image. should i turn all my data training im...
First detect the cars present in the image, and obtain their size and alignment. Then go for segmentation and labeling of the parking lot by fixing a suitable size and alignment.
0.135221
false
2
5,080
2017-09-05 13:26:03.680
How to install Python using Windows Command Prompt
Is it possible to install Python from cmd on Windows? If so, how to do it?
For Windows I was unable to find a way to Download python using just CMD but if you have python.exe in your system then you can use the below Method to install it (you can also make .bat file to automate it.) Download the python.exe file on your computer from the official site. Open CMD and change Your directory to ...
0.135221
false
1
5,081
2017-09-07 13:42:52.740
TensorFlow: How to handle void labeled data in image segmentation?
I was wondering how to handle not labeled parts of an image in image segmentation using TensorFlow. For example, my input is an image of height * width * channels. The labels are too of the size height * width, with one label for every pixel. Some parts of the image are annotated, other parts are not. I would wish that...
If I understand correctly you have a portion of each image with label void in which you are not interested at all. Since there is not a easy way to obtain the real value behind this void spots, why don't you map these points to background label and try to get results for your model? I would try in a preprocessing state...
0.386912
false
1
5,082
2017-09-07 14:52:49.203
How to detect if a GET request is from a browser or not
I'm looking for a way to show html to a user if they call from a browser or just give them the API response in JSON if the call is made from an application, terminal with curl or generally any other way. I know a number of APIs do this and I believe Django's REST framework does this. I've been able to fool a number of ...
I know this post is a few years old, but since I stumbled upon it... tldr; Do not use the user agent to determine the return format unless absolutely necessary. Use the Accept header or (less ideal) use a separate endpoint/URL. The standard and most future-proof way to set the desired return format for a specific endp...
0.545705
false
1
5,083
2017-09-07 16:39:20.957
how can i join two users in a telegram chat bot?
I am going to make a telegram bot in Python 3 which is a random chat bot. As I am new in telegram bots, I don't know how to join two different people in a chat bot. Is there a guide available for this?
You need to make a database with chatID as primary column. and another column as partner. which stores his/her chat partner chatID. now when a user sends a message to you bot you just need to check the database for that user and send the message to her chat partner. after the chat is done you should empty partner field...
1.2
true
2
5,084
2017-09-07 16:39:20.957
how can i join two users in a telegram chat bot?
I am going to make a telegram bot in Python 3 which is a random chat bot. As I am new in telegram bots, I don't know how to join two different people in a chat bot. Is there a guide available for this?
I am not sure to understand your question, can you give us what you pretend to do more explained? You have a few options, creating a group and adding the bot to it. In private chat you only can talk with a single user at a time.
0
false
2
5,084
2017-09-08 02:07:39.457
Should I put ntlk.download() in my .py file?
For some reason, when I put nltk.download() in my .py file after import nltk, it doesn't run correctly in Spyder. It does run with the anaconda prompt though. Should I include it in my .py file? If so, how do I get Spyder to be ok with that? Thanks!
I don't know what you want actually. If you just need the corpus in nltk, you don't have to put nltk.download() in you code but run nltk.download() once in the shell and download the corpus you need. Remind there is another function called nltk.download-gui(). You can try it in spyder or maybe you should change the gra...
0
false
1
5,085
2017-09-09 06:47:01.070
python how to define function with optional parameters by square brackets?
I often find some functions defined like open(name[, mode[, buffering]]) and I know it means optional parameters. Python document says it's module-level function. When I try to define a function with this style, it always failed. For example def f([a[,b]]): print('123') does not work. Can someone tell me what the modul...
Up to now, I still don't get an answer expected. Initially, when I saw this way of expression open(name[, mode[, buffering]]), I really want to know what does that mean. It means optional parameters obviously. At that moment, I found it may be a different way(different from normal way like f(a,b,c=None,d='balabala')) t...
0.135221
false
2
5,086
2017-09-09 06:47:01.070
python how to define function with optional parameters by square brackets?
I often find some functions defined like open(name[, mode[, buffering]]) and I know it means optional parameters. Python document says it's module-level function. When I try to define a function with this style, it always failed. For example def f([a[,b]]): print('123') does not work. Can someone tell me what the modul...
"1. if we can define optional parameters using this way(no at present)" The square bracket notation not python syntax, it is Backus-Naur form - it is a documentation standard only. A module-level function is a function defined in a module (including __main__) - this is in contrast to a function defined within a cla...
1.2
true
2
5,086
2017-09-11 09:44:44.803
Monte Carlo Marcov Chain with pymc
I'm trying to build a MCMC model to simulate a changing beavior over time. I have to simulate one day with a time interval of 10-minutes. I have several observations of one day from N users in 144 intervals. So I have U_k=U_1,...,U_N U users with k ranging from 1 to N and for each user I have X_i=X_1,...X_t samples. ...
Perhaps, assuming each user behaves the same way in a particular time interval, at each interval t we can get the matrix [ Pr 0->0 , Pr 1->0; Pr 1->0 , Pr 1->0] where Pr x ->y = (the number of people in interval t+1 who are in state y AND who were in state x in interval t) divided by (the number of people who were in...
0.201295
false
1
5,087
2017-09-12 01:48:11.450
Using PyDictionary to check if a word exists
Very new to the PyDictionary library, and have had some trouble finding proper documentation for it. So, I've come here to ask: A) Does anybody know how to check if a word (in english) exists, using PyDictionary? B) Does anybody know of some more full documentation for PyDictionary?
If you read the code here in theory there is this: meaning(term, disable_errors=False) so you should be able to pass True to avoid printing the error in case the word is not in the dictionary. I tried but I guess the version I installed via pip does not contains that code...
0.201295
false
1
5,088
2017-09-12 10:59:18.897
using python multiprocessing to control independent background workers after the spawning process has been closed
i see a lot of examples of how to use multiprocessing but they all talk about spawning workers and controlling them while the main process is alive. my question is how to control background workers in the following way: start 5 worker from command line: manager.py --start 5 after that, i will be able to list and stop...
The most portable solution I can suggest (although this will still involve further research for you), is to have a long-running process that manages the "background worker" processes. This shouldn't ever be killed off, as it handles the logic for piping messages to each sub process. Manager.py can then implement logic ...
0
false
1
5,089
2017-09-12 12:40:33.907
Why/How does Pandas use square brackets with .loc and .iloc?
So .loc and .iloc are not your typical functions. They somehow use [ and ] to surround the arguments so that it is comparable to normal array indexing. However, I have never seen this in another library (that I can think of, maybe numpy as something like this that I'm blanking on), and I have no idea how it technically...
Underneath the covers, both are using the __setitem__ and __getitem__ functions.
0.386912
false
1
5,090
2017-09-12 13:42:57.877
What is the hostname for a Google Cloud PostgreSQL instance?
I'm trying to connect to a PostgreSQL database on Google Cloud using SQLAlchemy. Making a connection to the database requires specifying a database URL of the form: dialect+driver://username:password@host:port/database I know what the dialect + driver is (postgresql), I know my username and password, and I know the da...
Hostname is the Public IP address.
0.386912
false
1
5,091
2017-09-12 19:15:43.140
Does Scrapy 'know' when it has crawled an entire site?
I have used Beautiful Soup with great success when crawling single pages of a site, but I have a new project in which I have to check a large list of sites to see if they contain a mention or a link to my site. Therefore, I need to check the entire site of each site. With BS I just don't know yet how to tell my scraper...
Scrapy uses a link follower to traverse through a site, until the list of available links is gone. Once a page is visited, it's removed from the list and Scrapy makes sure that link is not visited again. Assuming all the websites pages have links on other pages, Scrapy would be able to visit every page of a website. ...
1.2
true
1
5,092
2017-09-12 19:57:39.427
Bundle all packages required from a Python script into a folder
I have my Python script and my requirements.txt ready. What I want to do is to get all the packages listed in the "requirements.txt" into a folder. In the bundle, I'd for example have the full packages of "pymysql", "bs4" as well as all their dependencies. I have absolutely no idea how to do this. Could you help me ple...
Couldn't you just use a virtual environment (virtualenv folder_name) and then activate it unless you are looking for something else. Once it's activated install of your libraries and drown its there using pip install
0
false
1
5,093
2017-09-13 10:03:21.797
how to add links and images in text field of django admin
I am using django to create a blog. In my model I am using a text field for my blog content. But I am unable to insert any image or a clickable link. How to add links(clickable) and insert images?
there is no thing like clickable link in Database.you can put link as text and while importing it to your HTML use , and for Images there are two options. either you put your image path name in database or change TextField in models to FileField.
0
false
1
5,094
2017-09-13 16:31:05.093
How to send, buffer, and receive Python objects between two python programs?
I have the following scenario. Data (packets in this case) are received processed by a Python function in real-time as each datum streams by. So each datum is received and translated into a python object. There is a light-weight algorithm done on that object which returns an output (small dictionary). Then the object i...
If you need to use different processes (as opposed to multiple functions in a single process), perhaps a messaging queue would work well for you? Whereby your first process would do whatever it does and put the results in a message queue, which your second process is listening to. There are obviously a lot of options a...
0
false
1
5,095
2017-09-14 08:47:52.983
TestRail and JIRA integration with Robot Framework (RIDE IDE)
We are using RIDE IDE and are trying to integrate TestRail and JIRA. We have downloaded the TestRail API python file (testrail.py), but we are not able to import it in our project in RIDE. Can we know how to implement the same. Is there any steps or tutorial video for integrating TestRail and JIRA in RIDE ? We are usin...
If you want to use a python library in a robot test, you will need to create your own library that provides keywords that use the library. You can't just import any random python library and expect it to work like a robot keyword library.
0.386912
false
1
5,096
2017-09-15 08:30:02.433
Since Selenium IDE is unmaintained, how to write Selenium tests quickly?
Selenium IDE is a very useful tool to create Selenium tests quickly. Sadly, it has been unmaintained for a long time and now not compatible with new Firefox versions. Here is my work routine to create Selenium test without Selenium IDE: Open the Inspector Find and right click on the element Select Copy CSS Selector Pa...
The best way is to learn how your app is constructed, and to work with the developers to add an id element and/or distinctive names and classes to the items you need to interact with. With that, you aren't dependent on using the fragile xpaths and css paths that the inspector returns and instead can create short, conci...
0
false
1
5,097
2017-09-15 16:34:32.830
conditional logit for panel data in python
I am trying to estimate a logit model with individual fixed effects in a panel data setting, i.e. a conditional logit model, with python. I have found the pylogit library. However, the documentation I could find, explained how to use the conditional logit model for multinomial models with varying choice attributes. Thi...
I'm the creator of pylogit. I don't have built in utilities for estimating conditional logits with fixed effects. However, you can use pylogit to estimate this model. Simply Create dummy variables for each decision maker. Be sure to leave out one decision maker for identification. For each created dummy variable, add ...
0.999329
false
1
5,098
2017-09-15 17:58:00.593
Using shutil library to copy contents of a directory from src to dst, but not the directory itself
So I have a directory called /src, which has several contents: a.png, file.text, /sub_dir1, /sub_dir2 I want to copy these contents into destination directory /dst such that the inside of /dst looks like this (assuming /dst is previously empty): a.png, file.text, /sub_dir1, /sub_dir2 I have tried shutil.copytree(src, d...
I made a mistake with the file pathways I inputted into the copytree function. The function works as expected, in the way I mentioned I wanted it to in my question.
0
false
1
5,099
2017-09-15 19:17:04.410
Control Multiple Raspberry Pis Remotely / Gameshow Type System
I am trying to set up a gameshow type system where I have 5 stations each having a monitor and a button. The monitor will show a countdown timer and various animations. My plan is to program the timer, animations, and button control through pygame and put a pi at each station each running it's own pygame script, waitin...
This ought to work ... but it's purely hypothetical: Use a parallel circuit to set a pin "high" and "low" - "high" means start the timer; "low" means stop the timer. The next "high" resets and restarts the timer. You could use two circuits. One for start/stop and one for "reset". You'd probably need some code to not...
0
false
1
5,100
2017-09-16 09:07:54.803
How to extract reviews from facebook public page without page access token?
I want to extract reviews from public facebook pages like airline page, hospital page, to perform sentiment analysis. I have app id and app secret id which i generated from facebook graph API using my facebook account, But to extract the reviews I need page access token and as I am not the owner/admin of the page so I ...
Without a Page Token of the Page, it is impossible to get the reviews/ratings. You can only get those for Pages you own. There is no paid service either, you can only ask the Page owners to give you access.
0.386912
false
1
5,101
2017-09-17 19:14:10.500
Storing a username and password, then allowing user update. Python
I am trying to create a program that asks the user for, in this example, lets say a username and password, then store this (I assume in a text file). The area I am struggling with is how to allow the user to update this their password stored in the text file? I am writing this in Python.
Is this a single user application that you have? If you can provide more information one where you're struggling You can read the password file (which has usernames and passwords) - When user authenticate, match the username and password to the combination in text file - When user wants to change password, then user p...
-0.201295
false
2
5,102
2017-09-17 19:14:10.500
Storing a username and password, then allowing user update. Python
I am trying to create a program that asks the user for, in this example, lets say a username and password, then store this (I assume in a text file). The area I am struggling with is how to allow the user to update this their password stored in the text file? I am writing this in Python.
Because you've asked to focus on how to handle the updates in a text file, I've focused on that part of your question. So, in effect I've focused on answering how would you go about having something that changes in a text file when those changes impact the length and structure of the text file. That question is indep...
0
false
2
5,102
2017-09-17 19:41:05.180
How can i execute my webbrowser in Python?
I need to execute my webbrowser (opera) from python code, how can i get it? Python version 3.6, OS MS Windows 7
You can use Selenium to launch web browser through python.
0
false
1
5,103
2017-09-18 23:43:24.997
Checking if time-delta value is in range past midnight
So if I have two timedelta values such as 21:00:00(PM) as start time and 03:00:00 (AM) as end time and I wish to compare 23:00:00 within this range, to see whether it falls between these two, without having the date value, how could I do so? So although in this example it will see 23:00:00 larger than 21:00:00 it will ...
It becomes "difficult" only when endtime is smaller than starttime (IE, next day). But, you could have a test, if this is the case, add 12 hours to all three items, so now you can easily test and verify that 11am is between 9am and 3pm.
0
false
1
5,104
2017-09-19 06:23:50.230
Python save file permissions & owner/group and restore later
I have the following problem. I need to replace a file with another one. As far as the new is transfered over the network, owner and group bits are lost. So I have the following idea. To save current permissions and file owner bits and than after replacing the file restore them. Could you please suggest how to do this...
You can use rsync facility to copy the file to remote location with same permissions. A simple os.system(rsync -av SRC <DEST_IP>:~/location/) call can do this. Another methods include using a subprocess.
0
false
1
5,105
2017-09-19 06:26:16.633
Pycharm default interpreter and tmp working directory on Ubuntu
I use Pycharm for a while now and I'm getting really annoyed that my Pycharm interpreter settings always resets for some reason. Meaning that whenever I open up a new/old project it will always tell me that: No Python interpreter configured... even after I change and apply the settings in File > Settings > Project: P...
how do I actually make Pycharm save my interpreter settings and stop asking me about it. I was having a similar issue when I used PyCharm Community 2017.3 on Ubuntu 16.04 for the first time. The solution was to open the project folder rather than a specific script.
0.673066
false
1
5,106
2017-09-19 17:18:41.397
How to run python code in Sublime Text 3?
So I'm trying to run python code from Sublime Text 3, but I'm not sure how. Even if it was only from the console, that would be fine. Anybody know how???
Tools->Build System->Python or Ctrl+B
0.580532
false
1
5,107
2017-09-19 18:28:44.313
Use Django-Storages with IAM Instance Profiles
Django-Storages provides an S3 file storage backend for Django. It lists AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as required settings. If I am using an AWS Instance Profile to provide S3 access instead of a key pair, how do I configure Django-Storages?
The docs now explain this: If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are not set, boto3 internally looks up IAM credentials.
0.201295
false
1
5,108
2017-09-19 18:54:10.123
Completely removing Tensorflow, pip and virtualenv
I am new to all the tensorflow and Python programming and have installed tensorflow through pip and virtualenv but now I read that in order to use Spyder for Python it is best to use Anaconda. I know that tf can be installed through conda as well but how do I go about it now? Do I have to completely remove the existing...
Yes, after a short reading into the topic, I simply unistalled tf using sudo pip uninstall tensorflow within my virtualenv and then deactivated the virtualenv. Don't know how to really uninstall the virtualenv as well but I guess that is already enough then and I can proceed with the installation of Anaconda? I also ha...
0
false
2
5,109
2017-09-19 18:54:10.123
Completely removing Tensorflow, pip and virtualenv
I am new to all the tensorflow and Python programming and have installed tensorflow through pip and virtualenv but now I read that in order to use Spyder for Python it is best to use Anaconda. I know that tf can be installed through conda as well but how do I go about it now? Do I have to completely remove the existing...
Just install Anaconda it will take care of everything. Uninstalling the existing ones is up to you, they wont harm anything.
0
false
2
5,109
2017-09-20 05:47:20.153
Python: Apple Email Content
I am developing a program in python that can read emails, my program can now read emails from GMAIL even with attachment but my program can't read the email that was sent from Apple Mail. Unlike the email that I sent from GMAIL when I use Message.get_payload() in apple mail it does not have a value. I'm a newbie on py...
This is okay now It seems like the content type of the email i sent from Apple Mail was multipart which includes a "text/plain" which contains the text inside my email and "multipart/related" that contains the image i attached. So i just needed to check if the email is a multipart if so then loop it to print all payloa...
0
false
1
5,110
2017-09-20 09:09:22.613
Using .PYD file in C#?
I am developing a program using C#, but I just figured out that what I am going to program is very very difficult in C# yet easy in Python. So what I want to do is make a .PYD file and use it in C# program, but I don't know how. I've been searching about it but I couldn't find anything. So these are my questions: How ...
A .pyd file IS a DLL but with function init*() where * is the name of your .pyd file. For example, spam.pyd has a function named initspam(). They are not just similar, but the same! They are usable on PCs without Python. Do not forget: builtins will NOT be available. Search for them in C, add them as an extern in your...
0.386912
false
1
5,111
2017-09-20 13:05:51.673
send email whenever ec2 is shut down using serverless
i am new to serverless framework and aws, and i need to create a lambda function on python that will send email whenever an ec2 is shut down, but i really don't know how to do it using serverless. So please if any one could help me do that or at least give me some tracks to start with.
You can use CloudWatch for this. You can create a cloudwatch rule Service Name - Ec2 Event Type - EC2 Instance change notification Specific state(s) - shutting-down Then use an SNS target to deliver email.
0.386912
false
1
5,112
2017-09-21 14:59:21.363
How can i open my app only when wifi is enabled for upload Ads?
I've created with python and kivy an android app that works offline, app shows landscape photos, how can i open my app only when wifi is enabled? to let my app upload ads,have patience with me im new Thank You.
There's a dirty method though.. try requesting google.com or any other reliable website in the background with urllib or requests or socket, if its not getting any reply it must mean that system is not connected to internet
0
false
1
5,113
2017-09-21 15:00:26.013
print_rows(num_rows=m, num_columns=n) in graphlab / turi not working
I using jupyter notebook and graphlab / turi for tfidf-nearest_neighbors model, which works fine so far. However, when I query the model like tfidf_model.query(Test_AD) I always just get the head - [5 rows x 4 columns] I am supposed to use "print_rows(num_rows=m, num_columns=n)" to print more rows and columns like: tf...
ok, well, seems like I have to define the number or neighbours with: tfidf_model.query(Test_AD, k=100).show() so I can get a list of first 100 in the canvass.
0
false
1
5,114
2017-09-23 06:22:19.680
Pygame/Kivy on Android?
So, I'm programming in Python 3.2 on android (the app I'm using is QPython3) and I wonder if I could make a game/app with a graphic interface for android, using only a smartphone. Is it possible? If yes, how do I do that?
Look at using Linux (a different Kernal) distro on your phone. Many will basically act as a pc, just lacking power. I'm sure there is one you can run regular Python with. Then you may also look at renpy for porting it to android, or even kivy but i'm thinking kivy would be very different than anything you have, and req...
0
false
1
5,115
2017-09-23 07:49:06.190
solving Ax =b for a non-square matrix A using python
I'm focusing on the special case where A is a n x d matrix (where k < d) representing an orthogonal basis for a subspace of R^d and b is known to be inside the subspace. I thought of using the tools provided with numpy, however they only work with square matrices. I had the approach of filling in the matrix with some l...
Can use: np.linalg.lstsq(x, y) np.linalg.pinv(X) @ y LinearRegression().fit(X, y) Where 1 and 2 are from numpy and 3 is from sklearn.linear_model. As a side note you will need to concatenate ones(use np.ones_like) in both 1 and 2 to represent the bias from the equation y = ax + b
0
false
1
5,116
2017-09-23 13:31:02.857
cx_oracle PK autoincrementarion
can I get some advice, how to make mechanism for inserts, that will check if the values of PK is used? If it is not used in the table, it will insert row with number. If it is used, it will increment value and check next value if it's used. So on...
This is too long for a comment. You would need a trigger in the database to correctly implement this functionality. If you try to do it in the application layer, then you will be subject to race conditions in a multi-client environment. Within Oracle, I would recommend just using an auto-generated column for the prima...
0
false
1
5,117
2017-09-23 18:53:46.007
How do I add a python3 kernel to my jupyter notebook?
I installed jupyter notebook along with anaconda python as the only python on my PC (Windows 10). However I recently installed python 3.6.2 and I wonder if I can somehow add it to jupyter so as I can use them changeably. I remember having both on my other machine when I installed python first and then after that I ins...
Simple, just find where the script jupyter-notebook resides, for example ~/.local/bin if you installed it locally. Then just edit the first line to: #!/usr/bin/python3 will be fine.
0
false
1
5,118
2017-09-23 21:52:47.533
How do libevent chooses the next Gevent greenlet to run?
I am trying to understand the way Gevent/Greenlet chooses the next greenlet to be run. Threads use the OS Scheduler. Go Runtime uses 2 hierarchical queues. By default, Gevent uses libevent to its plumbling. But how do libevent chooses the next greenlet to be ran, if many are ready to? Is it random? I already had read ...
It's underlying dispatch model, is the event loop in libevent, which uses the event base, which monitors for the different events, and reacts to them accordiningly, then from what I gleamed , it will take the greenlets do some fuckery with semaphores, and then dispatch it onto libevent.
0
false
1
5,119