Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
44,706,706 | 2017-06-22T18:15:00.000 | 0 | 0 | 0 | 0 | python,sql,pandas | 44,707,209 | 3 | false | 0 | 0 | Rather than using the pandas library, make a database connection directly (using psycopg2, pymysql, pyodbc, or other connector library as appropriate) and use Python's db-api to read and write rows concurrently, either one-by-one or in whatever size chunks you can handle. | 1 | 3 | 0 | I am trying to retrieve a large amount of data(more than 7 million) from database and trying to save a s flat file. The data is being retrieved using python code(python calls stored procedure). But I am having a problem here. The process is eating up so much of memory hence killing the process automatically by unix mac... | Reading and writing large volume of data in Python | 0 | 1 | 0 | 6,717 |
44,708,430 | 2017-06-22T20:03:00.000 | 0 | 1 | 0 | 1 | python,google-cloud-platform,google-cloud-pubsub | 64,239,668 | 2 | false | 1 | 0 | This is how I usually do:
1. I create a python client class which does publish and subscribe with the topic, project and subscription used in emulator.
Note: You need to set PUBSUB_EMULATOR_HOST=localhost:8085 as env in your python project.
2. I spin up a pubsub-emulator as a docker container.
Note: You need to set som... | 1 | 1 | 0 | I'm working on a flask API, which one of the endpoint is to receive a message and publish it to PubSub. Currently, in order to test that endpoint, I will have to manually spin-up a PubSub emulator from the command line, and keep it running during the test. It working just fine, but it wouldn't be ideal for automated te... | How to boot up a test pubsub emulator from python for automated testing | 0 | 0 | 0 | 768 |
44,709,221 | 2017-06-22T20:54:00.000 | 1 | 1 | 1 | 0 | python | 44,709,283 | 1 | true | 0 | 0 | Try a Python linter, they will do this for you, for example flake8. Install with pip install flake8 and run by calling flake8 in the root folder of your project. | 1 | 3 | 0 | The title says it all. I am cleaning up python scripts I have written. Sometimes in the writing of scripts I have tried out one library only to replace it, or not use it later.
I would like to be able to check if a library which is imported is actually used within the script later. Ideally i would do this without havi... | How can I check if an imported library is 'used' in a python script? | 1.2 | 0 | 0 | 718 |
44,709,252 | 2017-06-22T20:55:00.000 | 1 | 0 | 1 | 0 | python,intellij-idea,ide | 49,150,590 | 2 | false | 1 | 0 | Open the root folder. And you should find the 64 bits version in it. You can then create a short cut for that.You should be fine. | 1 | 2 | 0 | I am trying to learn Python from an online course that I purchased. The instructor uses IntelliJ IDEA as an IDE and since I am trying to follow along I am trying to use it as well. When I download IntelliJ IDEA and then try to open it I receive the following error message: "No JVM Installation found. Please install ... | Error Launching IDEA: No JVM Installation Found | 0.099668 | 0 | 0 | 7,803 |
44,711,048 | 2017-06-22T23:57:00.000 | 0 | 0 | 1 | 0 | python,string,utf-8,byte | 44,711,115 | 2 | false | 0 | 0 | You need to decode the byte data:
byte_data.decode("utf-8") | 1 | 1 | 0 | I'm a Python3 User. And I'm now face some problem about byte to string control..
First, I'm get data from some server as a byte.
[Byte data] : b'\xaaD\x12\x1c+\x00\x00 \x18\x08\x00\x00\x88\xb4\xa2\x07\xf8\xaf\xb6\x19\x00\x00\x00\x00\x03Q\xfa3/\x00\x00\x00\x1d\x00\x00\x00\x86=\xbd\xc9~\x98uA>\xdf#=\x9a\xd8\xdb\x18\x1c_... | How to escape the string "\x0a\xfd\x ....." in python? | 0 | 0 | 0 | 1,232 |
44,711,255 | 2017-06-23T00:26:00.000 | 0 | 0 | 1 | 1 | python,pip | 44,713,819 | 2 | true | 0 | 0 | if you have already installed python of whatever version you can skip ahead to step 4 or step 6.
download and install python default installation is c:\python27
Create a new System Variable named Variable name: PYTHON_HOME and Variable
value: c:\Python27 (or whatever your installation path was)
Find the system variab... | 2 | 0 | 0 | I am trying to install pip for python in windows 7. I installed it and I added "C:\PythonXX\Scripts" to the windows path variables. But, when I typed "pip" in the command prompt it shows that pip is not recognized as an internal or external command.
Is there any way to figure out this problem? | Error found when installing pip on Windows | 1.2 | 0 | 0 | 6,397 |
44,711,255 | 2017-06-23T00:26:00.000 | -1 | 0 | 1 | 1 | python,pip | 44,713,170 | 2 | false | 0 | 0 | I know it's hustle to install pip in Windows. With latest Python you don't need to install pip, it's now prebuilt and you can access it by python -m pip | 2 | 0 | 0 | I am trying to install pip for python in windows 7. I installed it and I added "C:\PythonXX\Scripts" to the windows path variables. But, when I typed "pip" in the command prompt it shows that pip is not recognized as an internal or external command.
Is there any way to figure out this problem? | Error found when installing pip on Windows | -0.099668 | 0 | 0 | 6,397 |
44,711,267 | 2017-06-23T00:27:00.000 | 3 | 0 | 0 | 0 | python,user-interface,tkinter,widget | 44,711,332 | 1 | true | 0 | 1 | You can't mix grid and pack with widgets that share the same parent.
Why? Because grid will try to lay widgets out, possibly growing or shrinking widgets according to various options. Next, pack will try to do the same according to its rules. This may require that it change widget widths or heights.
grid will see tha... | 1 | 2 | 0 | I have a program with some Label() widgets, some Button() widgets, some Text() widgets, and a few Entry() widgets. A couple of revisions ago, I didn't have the labels, and I had less Entry() widgets, and I mixed .pack() and .grid() as was convenient and I was fine. I had to do some refactoring, and added the extra widg... | Using .pack() and .grid() at the same time with tkinter | 1.2 | 0 | 0 | 1,773 |
44,711,726 | 2017-06-23T01:31:00.000 | 0 | 0 | 0 | 0 | python,tensorflow,installation | 61,737,353 | 1 | false | 0 | 0 | Posting my own answer (alternative) here in case someone overlooked comment:
I forced to delete the package in the python/lib/site-packages/ and reinstalled the tensorflow-gpu, and it seems working well.
Though I solve this problem via such alternate I would still like to know the root cause and long-term fix for this... | 1 | 3 | 1 | I previously installed tensorflow-gpu 0.12.0rc0 with Winpython-3.5.2, and when I tried to upgrade or uninstall it to install the newer version using both the Winpython Control Panel and pip, I got the following error:
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'c:\\users\\moliang\\downlo... | Uninstall/upgrade tensorflow failed: __init__.cpython-35.pyc not found | 0 | 0 | 0 | 508 |
44,711,871 | 2017-06-23T01:55:00.000 | 1 | 0 | 0 | 0 | python,python-3.x,intellij-idea,ide | 44,711,956 | 1 | true | 0 | 0 | It is pre-compiled in some IDEs like PyDev but not in IDEA, you can add it manually if you want it. I also recommend you to use PyCharm instead of IDEA for python. | 1 | 0 | 0 | I am learning Python by watching youtube videos and also through an online course that I bought. In every video I watch, the first line of each file is: _author_='dev'. For some reason when I start a new file this does not come up. What does this mean and if it is an issue how do I correct it?
FYI I am using Intel... | script first line _author_="dev" does not show up | 1.2 | 0 | 0 | 91 |
44,711,944 | 2017-06-23T02:05:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,anaconda,ubuntu-16.04,python-3.6 | 44,711,971 | 2 | true | 0 | 0 | Anaconda2 (for python 2.7.x) and Anaconda3 (for 3.5/6) can exist side by side
edit: To use one as the default python just set the path (windows control panel->system->environment variables OR .bashrc ) to point to the one you want to use as default. ps there is no need to include both on the path and it's probably a b... | 1 | 1 | 0 | I have installed python 3.6 but python 2.7.13 is default also I have anaconda for python 2.7.13. But I want anaconda for python 3.6 which is not default can I download it directly? | Is it necessary that default python should be python3.6 to download anaconda for python3.6? | 1.2 | 0 | 0 | 389 |
44,713,145 | 2017-06-23T04:36:00.000 | 2 | 0 | 1 | 0 | python-3.x | 44,713,186 | 1 | false | 0 | 0 | A module\module_name can be one of these:
file
folder
folder with __init__.py inside of it
__main__ module name (the file you just run...)
you can change your module name or insert an object to *sys.modules that
will appear as a module
I hope this helps ... | 1 | 0 | 0 | What is the difference and relationship between module names and filenames in Python 3? Must a module name always be identical to the filename? | Python 3 Modules vs. filenames | 0.379949 | 0 | 0 | 357 |
44,713,742 | 2017-06-23T05:32:00.000 | 0 | 0 | 1 | 0 | python-2.7,python-multiprocessing | 56,736,434 | 2 | false | 0 | 0 | You can pass event.src_path to your main process as file gets modified (handle it in on_modified event of Event handler). | 1 | 2 | 0 | I have a set of 100 files which are created by an application. The files are updated dynamically not in the sequential manner. Using Python, I am trying to read the files. However, I don't know which file is getting updated at what time.
I don't want to every time loop through each and every file to check which files a... | Python trigger file change events | 0 | 0 | 0 | 6,661 |
44,714,345 | 2017-06-23T06:20:00.000 | 2 | 0 | 0 | 0 | python,sql,web,flask | 44,715,054 | 1 | true | 1 | 0 | This kind of data is called time series. There are specialized database engines for time series, but with a not-extreme volume of observations - (timestamp, wave heigh, wind, tide, which break it is) tuples - a SQL database will be perfectly fine.
Try to model your data as a table in Postgres or MySQL. Start by making ... | 1 | 0 | 0 | I have a basic personal project website that I am looking to learn some web dev fundamentals with and database (SQL) fundamentals as well (If SQL is even the right technology to use??).
I have the basic skeleton up and running but as I am new to this, I want to make sure I am doing it in the most efficient and "correct... | Flask website backend structure guidance assistance? | 1.2 | 1 | 0 | 181 |
44,716,368 | 2017-06-23T08:14:00.000 | 3 | 0 | 0 | 0 | python,machine-learning,scikit-learn | 44,736,370 | 1 | true | 0 | 0 | The NaNs are produced because the eigenvalues (self.lambdas_) of the input matrix are negative which provoke the ValueError as the square root does not operate with negative values.
The issue might be overcome by setting KernelPCA(remove_zero_eig=True, ...) but such action would not preserve the original dimensionality... | 1 | 2 | 1 | After applying KernelPCA to my data and passing it to a classifier (SVC) I'm getting the following error:
ValueError: Input contains NaN, infinity or a value too large for
dtype('float64').
and this warning while performing KernelPCA:
RuntimeWarning: invalid value encountered in sqrt X_transformed =
self.alphas_... | KernelPCA produces NaNs | 1.2 | 0 | 0 | 622 |
44,716,408 | 2017-06-23T08:16:00.000 | 0 | 0 | 1 | 0 | python,eclipse,documentation,pydev,docstring | 44,779,789 | 2 | false | 0 | 0 | Another coworker found the answer.
Properties of Project -> PyDev - PYTHONPATH -> Source Folders : Add Source Folder. Choose the file, where your code is.
For some reason, the eclipse of my coworkers did this automatically while mine didn't. | 2 | 0 | 0 | I'm working with PyDev on Eclipse and for some reason it doesn't show docstring when I'm hovering over a function. What also doesn't work, is to jump into a function when pressing F3. Both features work on the computer of my coworker. We tried it for the same functions in the same project.
We compared our settings in P... | PyDev doesn't show docstring | 0 | 0 | 0 | 280 |
44,716,408 | 2017-06-23T08:16:00.000 | 1 | 0 | 1 | 0 | python,eclipse,documentation,pydev,docstring | 44,719,860 | 2 | false | 0 | 0 | My guess is that the project isn't properly configured in your machine (probably a misconfiguration in the source folders).
Can you attach a screenshot showing the PyDev Package explorer for your project (expanding the project settings) and the editor where F3 is not working to better diagnose it?
Also, do you have som... | 2 | 0 | 0 | I'm working with PyDev on Eclipse and for some reason it doesn't show docstring when I'm hovering over a function. What also doesn't work, is to jump into a function when pressing F3. Both features work on the computer of my coworker. We tried it for the same functions in the same project.
We compared our settings in P... | PyDev doesn't show docstring | 0.099668 | 0 | 0 | 280 |
44,718,379 | 2017-06-23T09:50:00.000 | 1 | 0 | 0 | 0 | python,sql,postgresql,psycopg2 | 44,718,475 | 1 | false | 0 | 0 | you simple update the cell with the value NULL in SQL - psycopg2 will insert NULL into the database when you update your column with None-type from python. | 1 | 0 | 0 | I have a table in a PostgreSQL database.
I'm writing data to this table (using some computation with Python and psycopg2 to write results down in a specific column in that table).
I need to update some existing cell of that column.
Till now, I was able either to delete the complete row before writing this single ce... | Update field with no-value | 0.197375 | 1 | 0 | 878 |
44,719,592 | 2017-06-23T10:49:00.000 | 0 | 0 | 1 | 0 | macos,python-3.x,anaconda,jupyter | 44,719,685 | 1 | false | 0 | 0 | The OS on your MacBook Pro may be corrupted, try completely reformatting / resetting it to factory defaults. | 1 | 0 | 0 | I have just updated my MacBook Air 2014 with 4gb ram to a MacBook pro that is vastly more powerful, with 4* the ram & processing speed and installed the latest version of Anaconda, yet it is painfully slow.
Even the simplest oneliners of code take some 30 seconds to run, and even simple things crash the notebook!
It i... | Jupyter Notebook - incredibly slow code execution after the PC update | 0 | 0 | 0 | 412 |
44,720,075 | 2017-06-23T11:14:00.000 | 3 | 0 | 1 | 1 | python | 44,720,171 | 1 | true | 0 | 0 | You need to install the python development package (which contains the C headers files) for your OS (on debian-based distros it's named 'pythonX.X-dev' where 'X.X' is python version). | 1 | 3 | 0 | I am trying to install mysqlclient, but I get this error message:
_mysql.c:40:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Could anyone help me to resolve this? | fatal error: Python.h: No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 | 1.2 | 0 | 0 | 1,400 |
44,721,450 | 2017-06-23T12:27:00.000 | 0 | 0 | 1 | 0 | python,eclipse,import,pip,docx | 44,775,360 | 2 | false | 0 | 0 | thanks for the reply.
The actual problem was that I was using python 3.6 where eclipse only accepts python grammar versions up to 3.5. The docx package also only works with python 2.6, 2.7, 3.3, or 3.4 so I installed python 3.4 and docx is now working! | 1 | 0 | 0 | So basically I used pip to import the docx python package and it installed correctly, (verified by the freeze command). However I cannot import the package in eclipse.
Through some serious effort I've noticed that I can import the package using the 32 bit IDLE shell whereas I cannot when using the 64 bit IDLE shell. My... | Eclipse cannot import already installed pip package | 0 | 0 | 0 | 582 |
44,722,489 | 2017-06-23T13:20:00.000 | 0 | 0 | 1 | 0 | python,python-3.x | 44,722,649 | 1 | false | 0 | 0 | I had a similar problem in another IDE, and I solved it by making the folder I am importing from as a source folder. | 1 | 0 | 0 | My project is structured like this:
project/
--bin/
----__init__.py
----server/
------__init__.py
------server.py
----tool/
------__init__.py
------tool.py
In bin/server/server.py, I have this import:
from bin.tool.tool import tool_class
And when I run python3 bin/server/server.py, I get this error:
ModuleNotFoundErr... | ModuleNotFoundError for multi-level package directory? | 0 | 0 | 0 | 108 |
44,723,464 | 2017-06-23T14:08:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,deep-learning,keras | 45,011,256 | 1 | true | 0 | 0 | Low accuracy is caused by the problem in layers. I just modified my network and obtained .7496 accuracy. | 1 | 1 | 1 | I was trying to train CIFAR10 and MNIST dataset on VGG16 network. In my first attempt, I got an error which says shape of input_2 (labels) must be (None,2,2,10). What information does this structure hold in 2x2x10 array because I expect input_2 to have shape (None, 10) (There are 10 classes in both my datasets).
I trie... | VGG16 Training new dataset: Why VGG16 needs label to have shape (None,2,2,10) and how do I train mnist dataset with this network? | 1.2 | 0 | 0 | 212 |
44,724,653 | 2017-06-23T15:06:00.000 | 1 | 0 | 1 | 0 | python,git,pip | 44,724,801 | 1 | true | 0 | 0 | Yes. Dependent packages are looked up via said setup.py (setup_requires and install_requires). | 1 | 2 | 0 | Does anyone know if it is required that a Python repository has setup.py script in root directory in order for pip install git+[git repo] to work? How does pip find dependent packages from the source code?
Thanks! | requirement for "pip install git+[git repo]"? | 1.2 | 0 | 0 | 1,028 |
44,727,134 | 2017-06-23T17:38:00.000 | 1 | 0 | 1 | 0 | python,multithreading,multiprocessing | 44,729,595 | 1 | true | 0 | 0 | Python "threads" permit independent threads of execution, but typically do not permit concurrency because of the global interpreter lock: only one thread can really be running at a time. This may be the reason why you only get a speedup with multiple processes, which do not share a global interpreter lock and thus can... | 1 | 1 | 0 | I parse a big source code directory (100k files). I traverse every line in every file and do some simple regex matching. I tried threading this task to multiple threads but didn't get any speedup. Only multiprocessing managed to cut the time by 70%. I'm aware of the GIL death grip, but aren't threads supposed to help w... | python: disk-bound task, thread vs process | 1.2 | 0 | 0 | 154 |
44,727,232 | 2017-06-23T17:45:00.000 | 0 | 0 | 1 | 0 | python | 57,961,296 | 9 | false | 0 | 0 | This absolutely worked for me . I am using windows 10 professional edition and it has taken me almost 6 months to get this solution.Thanks to the suggestion made above.
I followed this suggestion and it worked right away and smoothly. All I did was to instruct the scheduler to run python.exe with my script as an argu... | 2 | 39 | 0 | I already tried to convert my .py file into .exe file. Unfortunately, the .exe file gives problems; I believe this is because my code is fairly complicated.
So, I am trying to schedule directly my .py file with Task Scheduler but every time I do it and then run it to see if works, a window pops up and asks me how I wou... | Scheduling a .py file on Task Scheduler in Windows 10 | 0 | 0 | 0 | 80,315 |
44,727,232 | 2017-06-23T17:45:00.000 | 1 | 0 | 1 | 0 | python | 44,728,388 | 9 | false | 0 | 0 | The script you execute would be the exe found in your python directory
ex) C:\Python27\python.exe
The "argument" would be the path to your script
ex) C:\Path\To\Script.py
So think of it like this: you aren't executing your script technically as a scheduled task. You are executing the root python exe for your computer w... | 2 | 39 | 0 | I already tried to convert my .py file into .exe file. Unfortunately, the .exe file gives problems; I believe this is because my code is fairly complicated.
So, I am trying to schedule directly my .py file with Task Scheduler but every time I do it and then run it to see if works, a window pops up and asks me how I wou... | Scheduling a .py file on Task Scheduler in Windows 10 | 0.022219 | 0 | 0 | 80,315 |
44,728,566 | 2017-06-23T19:19:00.000 | 2 | 1 | 0 | 0 | python,iphone,location,twilio | 44,731,799 | 2 | false | 0 | 0 | I solved a similar problem by creating a basic webpage which uses the HTML5 geolocation function to get lat/lng of the phone. It then submits coordinates to a php script via AJAX.
My server geocodes the employees location, calculates travelling time to next job and sends the customer an SMS with ETA information using t... | 1 | 0 | 0 | I have a webhook that handles any sms messages sent to my Twilio number. However, this webhook only works if there is text in the message (there will be a body in the GET request).
Is it possible to parse a message if it is a location message? e.g. if I send my current location to my Twilio number and it redirects thi... | iPhone "Send My Current Location" to Twilio | 0.197375 | 0 | 1 | 525 |
44,728,629 | 2017-06-23T19:24:00.000 | 0 | 0 | 1 | 0 | python | 44,738,179 | 2 | false | 0 | 0 | Then Cython is already installed. Go to your Python interpreter and type import cython and if there is no error you're fine. | 1 | 0 | 0 | i want install cython and when install with pip return to me this error:
Requirement already satisfied: cython in /usr/local/lib/python3.5/dist-packages
my pip version is pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5 and python version is Python 3.5.2 | Requirement already satisfied: cython | 0 | 0 | 0 | 1,779 |
44,733,040 | 2017-06-24T05:19:00.000 | 0 | 0 | 1 | 1 | python,windows-7,contextmenu,python-idle | 44,738,281 | 1 | false | 0 | 0 | Eventually it became clear that it was launching IDLE, but IDLE was exiting as soon as it got to the point of waiting for user input. Windows CMD scripts do that sometimes when they aren't feeling conversational.
I found the relevant script at F:\Python35\Lib\idlelib\Idle.bat. If you add a "/W" switch to the command, i... | 1 | 0 | 0 | There are a lot of threads from Python users on Windows who lose the "Edit with IDLE" option on the context menu (right click on a .py file in the File Explorer). I do have the menu item, but most of the time it appears to do nothing.
Checking the running applications and processes in Task Manager reveals nothing, exc... | Python's "EDIT with IDLE" runs but exits immediately (Win7) | 0 | 0 | 0 | 152 |
44,734,164 | 2017-06-24T07:46:00.000 | 3 | 0 | 1 | 1 | python-3.x,installation,ubuntu-16.04 | 44,744,454 | 2 | false | 0 | 0 | In your terminal, type : which python3 | 2 | 3 | 0 | I installed Python 3.6.1 on my Ubuntu 16 server and cannot find the install location. I have looked in /usr/bin and there are reference to all other versions except 3.6.1. Where can I find the executable for this version? | Python 3.6.1 install location | 0.291313 | 0 | 0 | 6,396 |
44,734,164 | 2017-06-24T07:46:00.000 | 4 | 0 | 1 | 1 | python-3.x,installation,ubuntu-16.04 | 44,734,300 | 2 | true | 0 | 0 | Use command "whereis python3.6.1" | 2 | 3 | 0 | I installed Python 3.6.1 on my Ubuntu 16 server and cannot find the install location. I have looked in /usr/bin and there are reference to all other versions except 3.6.1. Where can I find the executable for this version? | Python 3.6.1 install location | 1.2 | 0 | 0 | 6,396 |
44,734,534 | 2017-06-24T08:35:00.000 | 3 | 0 | 1 | 0 | python,module,semantics | 44,734,667 | 1 | true | 0 | 0 | What's in a name? But as we are at it: 'library' is no technical/syntactical term in python and there is no organisational structure that would you call a python library. officially specified or mandatory way how you would organize your files and directories in your repository in order to call your project/package/modu... | 1 | 1 | 0 | Is it wrong to refer to Python modules and packages as "libraries" ? Is there a technical differense ? Python documentation never mentions the word "library" in the packages or modules entry, but always refers to Pythons' built-in code as "library". | Confusing semantics on Python module system | 1.2 | 0 | 0 | 51 |
44,736,279 | 2017-06-24T12:16:00.000 | 0 | 0 | 0 | 0 | python,kivy,kivy-language | 44,750,212 | 2 | false | 0 | 1 | Use GridLayout but populate it with BoxLayouts instead of buttons. Orient each of these BoxLayouts vertically and populate the buttons inside. | 1 | 1 | 0 | I'm working on a relatively simple layout in Kivy, and want to display a series of buttons which get populated top to bottom of the screen, then when they reach the bottom, a new column is started from the top.
GridLayout appears to do what I want, but it always seems to go from left to right first, rather than top to ... | Kivy: GridLayout always goes left to right then down, can you go top to bottom then left to right? | 0 | 0 | 0 | 1,475 |
44,737,529 | 2017-06-24T14:36:00.000 | 0 | 1 | 0 | 1 | python,amazon-ec2,ansible | 44,737,817 | 1 | false | 1 | 0 | Looks like the problem was a temporary file in the hosts folder. After removing it the problems went away. It looks like std ansible behaviour: Pull in ALL files in the hosts folder. | 1 | 0 | 0 | I've seen a few posts on this topic with odd hard to reproduce behaviours. Here's a new set of data points.
Currently the following works
cd ./hosts
./ec2.py --profile=dev
And this fails
AWS_PROFILE=dev; ansible-playbook test.yml
These were both working a couple days ago. Something in my environment changed. Stil... | Ansible ec2.py runs standalone but fails in playbook | 0 | 0 | 0 | 1,445 |
44,740,161 | 2017-06-24T19:25:00.000 | 2 | 0 | 0 | 0 | python-3.x,nlp,word2vec | 44,740,700 | 1 | true | 0 | 0 | If you are splitting each entry into a list of words, that's essentially 'tokenization'.
Word2Vec just learns vectors for each word, not for each text example ('record') – so there's nothing to 'preserve', no vectors for the 45,000 records are ever created. But if there are 26,000 unique words among the records (after... | 1 | 0 | 1 | I have 45000 text records in my dataframe. I wanted to convert those 45000 records into word vectors so that I can train a classifier on the word vector. I am not tokenizing the sentences. I just split the each entry into list of words.
After training word2vec model with 300 features, the shape of the model resulted in... | how to preserve number of records in word2vec? | 1.2 | 0 | 0 | 277 |
44,741,368 | 2017-06-24T22:05:00.000 | 0 | 0 | 0 | 0 | python,django,amazon-web-services,nginx,amazon-ec2 | 44,742,316 | 1 | false | 1 | 0 | I’m pretty sure that you need to make this change wherever you host your domain. The only way i was able to do this with my personal server was to point to port 80instead of 8000 | 1 | 0 | 0 | Ok so I'm hosting a Django EC2 instance right now using ngrok http 8000 and leaving it running. It's doing fine but a lot of browsers are blocking the traffic to my site. I need to make my reserved domain (I have some on Amazon and some on 1 and 1) to my 123.4.5.67:8000 public IPv4 IP or just my public IPv4 DNS on my E... | How do I point my reserved domain to a Django EC2 instance? | 0 | 0 | 0 | 47 |
44,741,587 | 2017-06-24T22:39:00.000 | 4 | 0 | 0 | 0 | python,arrays,pandas,vector | 51,706,173 | 3 | false | 0 | 0 | Following on from VinceP's answer, to convert a datetime Series in-place do the following:
df['Column_name']=df['Column_name'].astype(str) | 1 | 32 | 1 | I am new to python (coming from R), and I am trying to understand how I can convert a timestamp series in a pandas dataframe (in my case this is called df['timestamp']) into what I would call a string vector in R. is this possible? How would this be done?
I tried df['timestamp'].apply('str'), but this seems to simply... | pandas timestamp series to string? | 0.26052 | 0 | 0 | 102,326 |
44,742,686 | 2017-06-25T02:35:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,google-chrome,python-requests,request-headers | 44,744,069 | 1 | false | 1 | 0 | Your using two different libraries (Chrome's internal http library and requests). It's very rare for two unrelated libraries to send the same set of headers, especially when one is from a browser. You could manually set those headers in requests but I'm not sure what you're trying to do | 1 | 0 | 0 | Just wondering if anyone could explain why I navigate to a webpage using Chrome and the request headers include Accept, Accept-Encoding, Accept-Language, Connection, Cookie, Host, Referer, Upgrade-Insecure-Request, and User-Agent but when I make a request via Python and print request.headers it only returns Connection,... | Python request.headers differs from what I see in Chrome | 0 | 0 | 1 | 498 |
44,750,239 | 2017-06-25T20:18:00.000 | 1 | 0 | 1 | 0 | performance,python-2.7,list,memory,initialization | 44,752,492 | 1 | false | 0 | 0 | List comprehensions provide a concise way to create lists. Common
applications are to make new lists where each element is the result of
some operations applied to each member of another sequence or
iterable, or to create a subsequence of those elements that satisfy a
certain condition.
First method is slower ... | 1 | 1 | 0 | Is there any difference in initializing a list of lists by
[[0 for i in xrange(n)] for j in xrange(m)]
or
[[0]*n for j in xrange(m)]
From the point of view of time performance the first way is 4 times faster than the second way, and I am wondering whether the first way has any computational/memory use or allocation... | Best way to initialize a list of lists | 0.197375 | 0 | 0 | 369 |
44,750,685 | 2017-06-25T21:13:00.000 | 1 | 0 | 1 | 0 | python,dictionary | 44,750,817 | 1 | false | 0 | 0 | I think dict is not the tool you should use.
It is used to store a mapping. The amount of data is not the issue here, 300,000-400,000 items is fair but not huge (if your data is mainly text, your dicts'size would be less than the size of a 740p movie).
But if your data should in the end be structured, in order to be qu... | 1 | 0 | 0 | I'm new to python and working on a program as a useful tool for my work. I have a messy, massive amount of data from different sources, and it would save me an enormous amount of time if I could store the data sets as I collect them. So I'm looking to put it together for personal use as quickly as possible, but to cont... | Handling large dicts as main purpose of program | 0.197375 | 0 | 0 | 63 |
44,753,724 | 2017-06-26T05:49:00.000 | 1 | 0 | 0 | 0 | python,mysql,qt,pyqt | 44,992,670 | 2 | true | 0 | 0 | It said driver available but you need to rebuid a new Mysql driver base on Qt Source code and Mysql Library. | 1 | 0 | 0 | I am trying to connect to a MySQL database using PyQt5 on Python 3.6 for 64-bit Windows. When I call QSqlDatabase.addDatabase('MYSQL') and run my utility, it shows up with this error message:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QP
SQL QPSQL7
This c... | PyQt QSqlDatabase: QMYSQL driver not loaded | 1.2 | 1 | 0 | 1,820 |
44,756,118 | 2017-06-26T08:56:00.000 | 1 | 0 | 0 | 0 | python,mysql,pymysql | 44,758,048 | 1 | false | 0 | 0 | I solved the problem by myself...
Because the config is automatically committed, so after each SQL sentence we should commit the changes.
Approach 1:
add cur.commit() after the cur.execute()
Approach 2:
edit the connection config, add autocommit=True | 1 | 0 | 0 | When I'm using pymysql to perform operations on MySQL database, it seems that all the operations are temporary and only visible to the pymysql connection, which means I can only see the changes through cur.execute('select * from qiushi') and once I cur.close() and conn.close() and log back in using pymysql, everything ... | Unable to INSERT with Pymysql (incremental id changes though) | 0.197375 | 1 | 0 | 377 |
44,756,937 | 2017-06-26T09:46:00.000 | 0 | 0 | 0 | 1 | python,azure-cosmosdb | 44,772,468 | 2 | false | 0 | 0 | DocumentDB allows only documents upto 2MB to be sent/inserted. What's the size of your document and how complex/nested it is? | 1 | 0 | 0 | I'm trying to send date to azure documentdb and I have to send a huge document (100 000+ lines), however when I send it I get a Request size is too large error.
I guess it should be possible to change this request size limit (which should be stored in a variable somewhere) but I can't find it, does someone know this ?
... | How to change pydocumentdb request size limit? | 0 | 0 | 0 | 85 |
44,757,705 | 2017-06-26T10:29:00.000 | 2 | 0 | 1 | 0 | python,visual-studio | 44,758,246 | 1 | true | 0 | 0 | python usually runs it in command prompt. Please let me if you need any more details or help | 1 | 2 | 0 | I'm using Microsoft Visual Studio Code with its Python support on Windows 7.
Now I can open an .py file and run it from menu Debug > Start Debugging. Is it possible to run it in command line? | Run python in command line in Microsoft Visual Studio Code? | 1.2 | 0 | 0 | 3,215 |
44,758,375 | 2017-06-26T11:09:00.000 | 2 | 0 | 0 | 0 | python,django,django-templates,django-views | 44,759,403 | 1 | true | 1 | 0 | In Django
a "view" is a callable that is responsible for handling a request and returning a response,
a template tag is a piece of code that will be executed in the context of rendering a template and will either push something in the template's context or render some text or markup.
Oranges and apples, really, and... | 1 | 2 | 0 | I'm in the process of delving into Django into a little more depth - and I now have certain blocks around my website which are recycled, but not necessarily suited to a being placed in base.html and then sprinkled with {% extends /root/to/base.html %}.
So, I have a bespoke widget I have created which is utilised on cer... | Best Django practise - when to use views and when to use tags | 1.2 | 0 | 0 | 36 |
44,763,274 | 2017-06-26T15:31:00.000 | 0 | 0 | 1 | 0 | python,anaconda | 44,763,421 | 1 | false | 0 | 0 | So python looks at the environmental variable PYTHONPATH to find the location of the Python packages. Change PYTHONPATH so that it points to where you have your non-Anaconda packages installed. PYTHONPATH is searched in order, so just make sure the location is before the Anaconda package install location.
You can do th... | 1 | 0 | 0 | I have anaconda python installed and it works great. However, occasionally I'd like to use my native python. If a run a file with /usr/bin/python file.py, any imports in the file are done from the anaconda package folder.
Even if I run /usr/bin/python to drop my self in the python console, and then try import packagen... | How to import non-anaconda packages | 0 | 0 | 0 | 111 |
44,763,743 | 2017-06-26T15:55:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,nlp,text-classification | 44,765,840 | 2 | false | 0 | 0 | I'm currently working on something similar,
besides what @Joonatan Samuel suggested I would encourage you to do careful preprocessing and considerations.
If you want two or more tags for documents you could train several model : one model per tag. You need to consider if there will be enough cases for each model (tag)... | 1 | 0 | 1 | I have thousands of documents with associated tag information. However i also have many documents without tags.
I want to train a model on the documents WITH tags and then apply the trained classifier to the UNTAGGED documents; the classifier will then suggest the most appropriate tags for each UNTAGGED document.
I hav... | supervised tag suggestion for documents | 0 | 0 | 0 | 461 |
44,763,758 | 2017-06-26T15:56:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,psycopg2,psycopg | 44,766,725 | 2 | true | 0 | 0 | The point is that values were edited with pgadmin3 (incorrectly, the correct way is shift+enter to add a new line). I asked the user to use phppgadmin (easier for him, multiline fields are edited with textarea control) and now everything is working properly.
So pyscopg2 WORKS fine, I'm sorry to thought it was the culpr... | 2 | 2 | 0 | I have some records data with \n. When I do a SELECT query using psycopg2 the result comes with \n escaped like this \\n. I want the result have literal \n in order to use splitlines(). | I don't want psycopg2 to escape new line character (\n) in query result | 1.2 | 1 | 0 | 972 |
44,763,758 | 2017-06-26T15:56:00.000 | -1 | 0 | 1 | 0 | python,python-3.x,psycopg2,psycopg | 44,763,994 | 2 | false | 0 | 0 | Try this: object.replace("\\n", r"\n")
Hope this helped :) | 2 | 2 | 0 | I have some records data with \n. When I do a SELECT query using psycopg2 the result comes with \n escaped like this \\n. I want the result have literal \n in order to use splitlines(). | I don't want psycopg2 to escape new line character (\n) in query result | -0.099668 | 1 | 0 | 972 |
44,763,957 | 2017-06-26T16:07:00.000 | 0 | 0 | 1 | 0 | string,python-3.x,pdf,docx,text-extraction | 44,766,319 | 1 | false | 0 | 0 | This is a pretty tough ask. What you are asking is not just a text search - that part would be relatively easy. But to find the page location you would have to work back from the string to is container, which would possibly be hierarchically nested - like a set of nested html elements - and calculate the position, then... | 1 | 0 | 0 | I am currently working on a project where I have to place a digital signature (.JPG file) on a PDF file under the string, 'Comments'.
I want to be able to find the coordinates or location somehow of the String, 'Comments' and then preferably place that signature.jpg several coordinates below it.
Originally, the file ... | Best tool for finding text location from .PDF or .DOCX in Python 3.4 | 0 | 0 | 0 | 426 |
44,765,124 | 2017-06-26T17:17:00.000 | 1 | 0 | 0 | 0 | python-2.7,tkinter,py2app | 44,765,155 | 1 | true | 0 | 1 | The python quit() and exit() functions are meant to be used in the REPL only. You need to use sys.exit() or raise SystemExit. | 1 | 0 | 0 | I have imported sys
I have tried using sys.quit, again works when I run it as a python script but not as an app.
I have also tried calling root.destroy() inside the app_exit function
context: I have a button called exit which calls an app_exit function which just calls the quit function. | quit() using Tkinter not working while executing as an app using py2app. However it works when I run it a python script | 1.2 | 0 | 0 | 79 |
44,767,704 | 2017-06-26T19:56:00.000 | 1 | 0 | 1 | 0 | python,python-2.7,inheritance | 44,768,152 | 2 | false | 0 | 0 | I may have misunderstood the question, but from what I understand, a housing has four (or some number of) instruments inside it. You would then want a class Housing and a class Instrument. A housing holds a list of instruments while each instrument is created with a reference to its housing. If an instrument has to do ... | 1 | 0 | 0 | This is mostly a program design question.
I have multiple identical instrument housings each of which contains four identical instruments that I can communicate with remotely. I want to make an instrument housing class that contains: methods to communicate with each housing, methods to do housing-specific operations, a... | Python: Subclass of a class instance? | 0.099668 | 0 | 0 | 1,898 |
44,769,832 | 2017-06-26T22:55:00.000 | 0 | 0 | 1 | 0 | python-3.x,python-sphinx,namespace-package | 44,790,172 | 1 | false | 0 | 0 | Looking at the output of "sphinx-quickstart" showed me the 3 steps to generate documentation:
"sphinx-quickstart" to create an initial directory structure with conf.py and index.rst
"sphinx-apidoc" to generate *.rst files, which can also be adapted further
"make html" or "sphinx-build" or "python setup.py build_sphinx... | 1 | 0 | 0 | sphinx-apidoc supports the option --implicit-namespaces to handle namespace packages according to PEP420. When I create the Sphinx documentation with "python setup.py build_sphinx", this does not work with namespace packages by default. Is there a relation between "python setup.py build_sphinx" and sphinx-apidoc (e. g.... | "python setup.py build_sphinx" and "sphinx-apidoc --implicit-namespaces" | 0 | 0 | 0 | 875 |
44,771,725 | 2017-06-27T03:13:00.000 | 0 | 0 | 0 | 0 | python,python-3.x,pyqt,pyqt4 | 44,775,948 | 1 | false | 0 | 1 | This is a pretty broad question. I recommend checking out the many tutorials on Youtube.com.
However, in your init method, put something like this:
self.ui.charge_codes_combo.currentIndexChanged.connect(self.setup_payments)
In my example, the combo box was placed on a form in Qt Designer. Self.setup_payment is a m... | 1 | 0 | 0 | Exactly how do I utilize the various event methods that widgets have? Say I have a comboBox(drop down list) and I want to initiate a function every time someone changes the choice. There is the changeEvent() method in the documentation but It would be great if someone explains to me with a piece of code. | How to use pyqt widget event() method? | 0 | 0 | 0 | 102 |
44,772,007 | 2017-06-27T03:54:00.000 | 6 | 1 | 1 | 1 | python,path,relative-path,absolute-path,pwd | 44,772,227 | 2 | false | 0 | 0 | The biggest consideration is probably portability. If you move your code to a different computer and you need to access some other file, where will that other file be? If it will be in the same location relative to your program, use a relative address. If it will be in the same absolute location, use an absolute addres... | 1 | 13 | 0 | For reference. The absolute path is the full path to some place on your computer. The relative path is the path to some file with respect to your current working directory (PWD). For example:
Absolute path:
C:/users/admin/docs/stuff.txt
If my PWD is C:/users/admin/, then the relative path to stuff.txt would be: docs/s... | When to use Absolute Path vs Relative Path in Python | 1 | 0 | 0 | 29,634 |
44,774,814 | 2017-06-27T07:45:00.000 | 0 | 0 | 1 | 0 | python,openerp,odoo-8,odoo-9,odoo-10 | 44,778,932 | 1 | false | 1 | 0 | This depends on the language the user has chosen. Under Settings/Translations/Languages (in newer versions of Odoo you first need to activate developer mode to see this menu) chose a language and look into "Thousands Separator" and "Decimal Separator".
For example using German language it's the other way around, becaus... | 1 | 0 | 0 | I noticed that whenever you type comma in integer field, odoo (or python) automatically removes that comma and merges numbers (for example whenever you type 1,3 it will become 13). If I type 1.3 or 1;3 etc. everything is fine. Probably I could do something like @api.constrains for a field, but how I could fix this for ... | How to prevent user from saving comma at integer field in whole Odoo system? | 0 | 0 | 0 | 741 |
44,776,765 | 2017-06-27T09:29:00.000 | 2 | 0 | 0 | 0 | python,svn,cmd,buildbot | 44,778,975 | 1 | false | 0 | 0 | You shouldn't have anything "pop up" if you're using the correct tools for automating your process. You're probably using TortoiseProc.exe, which is advertised as not being suitable for unattended/automated usage. TortoiseProc.exe is not the replacement for svn.exe client.
The command-line client svn is the correct way... | 1 | 1 | 0 | I created a Buildbot system and am using SVN with it and would like to do updates to my SVN without having to click the confirmations for when the update finished and committing version file. The buildbot system would just take in a command that would allow it to do all confirmation of updates and committing continuous... | Is there an SVN command that will allow me to confirm and skip windows (like Confirm Update! and Committing Version to File) that pop up? | 0.379949 | 0 | 0 | 160 |
44,776,786 | 2017-06-27T09:30:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy,scikit-learn | 44,777,825 | 1 | true | 0 | 0 | n_values should only contain domain sizes for categorical values completely skipping out the non-categorical columns in the data matrix.
Therefore if [True, False, True] format is used, the size should correspond to the number of True values in the array or if indices are used the two arrays should be of the same size.... | 1 | 0 | 1 | I am passing in a hardcoded list / tuple (tried both) when initialising the OneHotEncoder and I get this error during fit_transform , not using numpy types anywhere (well except for the data matrix itself).
The only thing is that some of the values in that array are None because I am also using categorical_features to ... | sklearn::TypeError: Wrong type for parameter `n_values`. Expected 'auto', int or array of ints, got | 1.2 | 0 | 0 | 1,561 |
44,780,195 | 2017-06-27T12:21:00.000 | 1 | 0 | 0 | 0 | python,numpy,scipy,numpy-einsum | 45,102,844 | 2 | false | 0 | 0 | First, why do you need B to be 2-dim? Why not just np.einsum('ab , b -> a', A, B)?
Now the actual question:
It's not exactly what you want, but by using smart choices for A and B you can make this visible. e.g. A = [[1,10],[100,1000]] and B = [1,2], which gives np.einsum('ab , b -> a', A, B) = [21,2100] and it's quite ... | 1 | 1 | 1 | I was planning to teach np.einsum to colleagues, by hoping to show how it would be reduced to multiplications and summations.
So, instead of numerical data, I thought to use alphabet chars. in the arrays.
Say, we have A (2X2) as [['a', 'b'], ['c', 'd']] and B (2X1) as [['e'], ['f']]
We could use einsum to create a matr... | Generating np.einsum evaluation graph | 0.099668 | 0 | 0 | 193 |
44,781,243 | 2017-06-27T13:13:00.000 | 1 | 0 | 1 | 0 | python,regex,python-2.x | 44,781,642 | 4 | false | 0 | 0 | Regular expressions may not be the the best solution. Here is one algorithm:
Make a dictionary of your target word with each letter being a key and the value(s) being the quantity of that letter in the word. e.g. for string, the key:value pair for s would be {'s':1}.
for each word you want to test check to see if eve... | 1 | 0 | 0 | I am new to Python re, but I need help. I searched here, google, documentation, but nothing worked. So here is what I am trying to do.
I have word (for example) "string"
then I have word list:
strings, string, str, ing, in, ins, rs, stress
And I want to matches like: string, str, ing, in, ins, rs.
I don't want to mat... | Python re match only letters from word | 0.049958 | 0 | 0 | 1,439 |
44,782,916 | 2017-06-27T14:29:00.000 | 1 | 0 | 0 | 0 | python,scikit-learn | 44,783,384 | 1 | false | 0 | 0 | It is not an error message, it is simply a warning that a module cross_validation has been transmitted from sklearn.cross_validation to sklearn.model_selection.. It is not a problem at all.
If you are still eager to fix it, then you should find out what snippet of code tries to import sklearn.cross_validation and alter... | 1 | 0 | 1 | Every time I run a tensorflow file on terminal, this warning pops up before the file runs. I have checked my version of sklearn and it is 0.18.1. How do you make this message to not appear? Thank you.
anaconda2/envs/tensorflow/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module w... | sklearn warning message whenever I run tensorflow on terminal | 0.197375 | 0 | 0 | 187 |
44,783,953 | 2017-06-27T15:15:00.000 | 2 | 1 | 0 | 0 | python,macos,selenium,automated-tests | 44,784,204 | 2 | false | 0 | 0 | Run the tests in a virtual machine. They will appear in the window you've logged into the VM with, which you can put anywhere you like or minimize/iconify and get on with your work.
(the actual solution I used at work was to hire a junior test engineer to run and expand our Selenium tests, but that doesn't always apply... | 1 | 2 | 0 | I'm running automated tests with Selenium and Python on Macbook and two monitors. The big issue with the tests is that the tests kept appearing wherever I was working. E.g. the test start on monitor A and I was googling or reporting bugs on monitor B. When the test teardown and setup again, but on monitor B.
It's very... | How to command automated tests to stay at one place of the monitor | 0.197375 | 0 | 1 | 43 |
44,784,860 | 2017-06-27T15:57:00.000 | -2 | 0 | 1 | 0 | python,multithreading,linux-kernel,python-multithreading | 52,535,497 | 2 | false | 0 | 0 | Just do the following:
t = threading.Thread(name='my_thread') | 1 | 16 | 0 | I would like to set the title of a thread (the title seen in ps or top)in Python in order to make it visible to process tracer programs. All the threads of a process are always called python or called file name when /usr/bin/python is used and the script is called via ./script.
Now, I want to change each thread's name.... | Is there a way to set title/name of a thread in Python? | -0.197375 | 0 | 0 | 19,619 |
44,786,571 | 2017-06-27T17:37:00.000 | 0 | 1 | 1 | 0 | python,floating-point,boolean,precision,abstract-data-type | 44,786,761 | 1 | false | 0 | 0 | I could think of that he meant, that you should not do calculations with long commma floats, as they will overflow and give you some kind of rounding. If you calculate with integers instead, you wont get them. and you cold shift commas later on.
as Artyr already mentioned, there is no unsigned Integer in Python, thats... | 1 | 1 | 0 | according to my professor, its boolean, unsigned integer, integer, float, complex, string, and object.
but why? how is a float less precise than an integer (for example)? Is it to do with the operations that ca be performed on a given item (ie the ore specific the things that can be performed, the most 'precise' the ty... | order of data types from greatest to least precision in python? | 0 | 0 | 0 | 102 |
44,787,713 | 2017-06-27T18:47:00.000 | 0 | 1 | 0 | 0 | python,twilio | 44,792,253 | 1 | true | 0 | 0 | I think your best bet is to purchase a phone number that is not MMS compatible. | 1 | 1 | 0 | Is there a way to disable MMS on a number from Twilio? I only see articles on disabling SMS entirely, and I want to disable MMS as there are additional charges and is not being used. | Disabling MMS on Twilio | 1.2 | 0 | 0 | 244 |
44,788,533 | 2017-06-27T19:40:00.000 | 0 | 0 | 1 | 0 | python,regex,str-replace | 44,788,966 | 1 | false | 0 | 0 | state code always contains 2 uppercase characters, so you can use this pattern to do your replacement.
match this:
([A-Z]{2}).
and replace by this: $1 | 1 | 0 | 0 | I have sentences with state codes followed by a . (ie. "CA.", "AL.", but also good "CA", "AL") or things like "acct." or "no."
I'd like to:
1. remove those "."
2. keep other "."
3. change no. to #
For example, I'd like:
"Mr. J. Edgar Hoover from CA. owes us $123.45 from acct. no. 98765."
to become
"Mr. J. Edgar Hoover... | Python remove . after state | 0 | 0 | 0 | 59 |
44,788,862 | 2017-06-27T19:58:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,docx,python-docx | 44,789,853 | 2 | false | 0 | 0 | A Word document produced by python-docx will preserve any headers and footers present in the "template" document. So the way to get those is to create a "starting" document that has the headers and footers you're after.
A header or footer can contain a page number field, which is automatically updated with the current ... | 1 | 2 | 0 | I think this question is pretty self explanatory. From what I've read of the python-docx documentation, it seems that the header and footer must be exactly the same on every page, which of course makes adding page numbers difficult. Is this possible? | How can I add page numbers to each page's footer with python-docx? | 0 | 0 | 0 | 3,202 |
44,789,046 | 2017-06-27T20:10:00.000 | 1 | 0 | 0 | 0 | python,mysql,django | 44,789,450 | 1 | true | 1 | 0 | I don't think you can get deadlock just from rapid insertions. Deadlock occurs when you have two processes that are each waiting for the other one to do something before they can make the change that the other one is waiting for. If two processes are just inserting, the database will simply process them in the order th... | 1 | 1 | 0 | I wanna migrate from sqlite3 to MySQL in Django. Now I have been working in Oracle, MS Server and I know that I can make Exception to try over and over again until it is done... However this is insert in a same table where the data must be INSERTED right away because users will not be happy for waiting their turn on IN... | MySql: will it deadlock on to many insert - Django? | 1.2 | 1 | 0 | 397 |
44,789,188 | 2017-06-27T20:20:00.000 | 0 | 0 | 1 | 0 | c#,python,camera,integration | 54,589,317 | 1 | true | 0 | 1 | Actually, there is a python interface availabe for working with and access the features of Basler camera namely pypylon | 1 | 1 | 0 | My employer currently has a lot of python code currently written and he wants me to create an application that interacts with this code and controls a Basler Ace Camera. The Basler Ace Cameras only support C, C#, C++ coding languages. What is the easiest way to integrate his Python code with the camera code which I am ... | Basler Ace Camera Integration with Python | 1.2 | 0 | 0 | 925 |
44,790,807 | 2017-06-27T22:16:00.000 | 1 | 1 | 1 | 0 | python,unix | 44,790,892 | 1 | false | 0 | 0 | python-dev contains everything you need to build Python extensions. So, it will typically include the Python.h header file, and probably some Python shared object files to link with.
If you have a compiler on the target machine, you can probably build that yourself by looking at how python-dev does it for various opera... | 1 | 2 | 0 | I couldn't find 'python-dev' package anywhere. I don't have the luxury to find it via pip or yum, since I don't have internet connection on my computer. I need to locate the 'python-dev' source, download it, and install it in my computer without internet and sudo access.
Thanks. | How can I install python-dev package in a computer without internet? | 0.197375 | 0 | 0 | 1,199 |
44,793,183 | 2017-06-28T03:30:00.000 | 2 | 0 | 1 | 0 | python,ipython | 44,798,696 | 4 | true | 0 | 0 | It seems I've found the solution.
You need to edit the file which starts IPython. On Linux you can enter it with: sudo nano $(which ipython).
Once you're inside the file change the shebang line to what ever Python interpreter you like.
And directories that contain Python3.4 modules need to be added to $PYTHONPATH var... | 1 | 6 | 0 | Can we change the version of Python interpreter that IPython uses?
I know there is IPython and IPython3, but the problem is, IPython uses Python2.7, and IPython3 uses Python3.4.2, and I see no way to change that.
What if I wanted IPython to use which ever version of Python interpreter I wanted, could I make it that wa... | How to set other Python interpreter to IPython | 1.2 | 0 | 0 | 6,691 |
44,793,371 | 2017-06-28T03:53:00.000 | 0 | 0 | 1 | 0 | python,multithreading,multiprocessing | 69,449,636 | 3 | false | 0 | 0 | Global Interpreter Lock (GIL) has to be taken into account to answer your question. When more number (say k) of threads are created, generally they will not increase the performance by k times, as it will still be running as a single threaded application. GIL is a global lock which locks everything out and allows only ... | 1 | 20 | 0 | To the best of my knowledge, multiple threads can be spawned within the system concurrently but 2 different threads can not access or modify the same resource at the same time. I have even tried many things like creating many threads and putting them in a queue etc. But always I used to hear people say multithreading i... | Is multithreading in python a myth? | 0 | 0 | 0 | 22,104 |
44,794,347 | 2017-06-28T05:34:00.000 | 3 | 0 | 0 | 0 | python-2.7,pyspark,seaborn | 46,108,215 | 1 | false | 0 | 0 | Generally, for plotting, you need to move all the data points to the master node (using functions like collect() ) before you can plot. PLotting is not possible while the data is still distributed in memory. | 1 | 0 | 1 | I am using Apache Pyspark with Jupyter notebook. In one of the machine learning tutorials, the instructors were using seaborn with pyspark. How can we install and use third party libraries like Seaborn on the Apache Spark (rather Pyspark)? | Installing seaborn on Pyspark | 0.53705 | 0 | 0 | 824 |
44,795,589 | 2017-06-28T06:58:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,google-cloud-platform | 44,805,435 | 1 | false | 1 | 0 | Based on my external observations of how things work, I suspect there is only a single ingress queue (per service/module) from which requests are only handed to instances which can immediately handle them.
The actual parameters of this single queue (depth, waiting time, etc) would be the indicators driving the automati... | 1 | 0 | 0 | I have B* instances running on App Engine(Python env) to serve user facing requests. Sometimes I see B* instances getting terminated due to Exceeded soft private memory limit
I understand that increasing the instance class will solve the issue but
I have few queries regarding requests that are present in the Instance ... | What happens to requests in Instance Request Pending Queue when a backend instance gets terminated due to "Exceeded soft private memory limit"? | 0.197375 | 0 | 0 | 34 |
44,796,047 | 2017-06-28T07:22:00.000 | 3 | 0 | 0 | 1 | python,tftp | 44,796,119 | 1 | false | 0 | 0 | You can use TFTPy
TFTPy is a pure Python implementation of the Trivial FTP protocol.
TFTPy is a TFTP library for the Python programming language. It includes client and server classes, with sample implementations. Hooks are included for easy inclusion in a UI for populating progress indicators. It supports RFCs 1350, 2... | 1 | 2 | 0 | Are there any TFTP libraries in Python to allow the PUT transfer of binary file to an IP address.
Ideally I would rather use a built in library if this is not possible then calling the cmd via python would be acceptable.
Usually if TFTP is installed in windows the command in command prompt would be:
tftp -i xxx.xxx.xx... | Running TFTP client/library in python | 0.53705 | 0 | 1 | 2,164 |
44,799,200 | 2017-06-28T09:53:00.000 | 3 | 0 | 0 | 0 | python,tensorflow,ipython | 44,799,700 | 1 | true | 0 | 0 | Control+Z doesn't quit a process, it stops it (use fg to bring it back up). If some computation is running in a forked process, it may not stop with the main process (I'm no OS guy, this is just my intuition).
In any case, properly quitting iPython (e.g. by Control+D or by running exit()) should solve the problem. If y... | 1 | 0 | 1 | I think it's some sort of bug.
The problem is quite simple:
launch ipython
import Tensorflow and run whatever session
type nvidia-smi in bash (see really high gpu memory usage, related process name, etc)
control+z quit ipython
type nvidia-smi in bash (still! really high GPU memory usage, and the same process name, str... | When run a tensorflow session in iPython, GPU memory usage remain high when exiting iPython | 1.2 | 0 | 0 | 449 |
44,804,051 | 2017-06-28T13:34:00.000 | 1 | 0 | 0 | 0 | python,pandas,google-bigquery,google-cloud-platform,gsutil | 44,814,853 | 1 | true | 0 | 0 | Consider breaking up your data into daily tables (or partitions). Then you only need to upload the CVS from the current day.
The script you have currently defined otherwise seems reasonable.
Extract your new day of CSVs from your source of timeline data.
Gzip them for fast transfer.
Copy them to GCS.
Load the new CVSs... | 1 | 0 | 1 | I have one program that downloads time series (ts) data from a remote database and saves the data as csv files. New ts data is appended to old ts data. My local folder continues to grow and grow and grow as more data is downloaded. After downloading new ts data and saving it, I want to upload it to a Google BigQuery ta... | Python/Pandas/BigQuery: How to efficiently update existing tables with a lot of new time series data? | 1.2 | 1 | 0 | 642 |
44,804,099 | 2017-06-28T13:36:00.000 | 1 | 0 | 1 | 0 | python,html,database,webpage | 44,804,332 | 1 | false | 1 | 0 | You could use Apache or another web server. Set up an HTML web page with javascript. I recommend using jQuery as it makes making ajax calls so much easier. Have your javascript/ajax/jquery call your python script every x minutes/seconds.
Ensure your apache server is setup to run CGI scripts and ensure they are set with... | 1 | 0 | 0 | I have a python script that collects data on some virtual machines. I want to display this data in a webpage.The web page must be dynamic since the script will run continuously and the data must be updated every time the script runs. I possibly want this data displayed in a table but I am not sure what direction to go? | Best way to display python script data in a webpage? | 0.197375 | 0 | 0 | 653 |
44,804,235 | 2017-06-28T13:42:00.000 | 1 | 0 | 0 | 0 | python,csv,pandas,merge,delimiter | 44,804,374 | 1 | true | 0 | 0 | In short : no, you do not need similar delimiters within your files to merge pandas Dataframes - in fact, once data has been imported (which requires setting the right delimiter for each of your files), the data is placed in memory and does not keep track of the initial delimiter (you can see this by writing down your ... | 1 | 0 | 1 | I have 4 separate CSV files that I wish to read into Pandas. I want to merge these CSV files into one dataframe.
The problem is that the columns within the CSV files contain the following: , ; | and spaces. Therefore I have to use different delimiters when reading the different CSV files and do some transformations to ... | Pandas: Reading CSV files with different delimiters - merge error | 1.2 | 0 | 0 | 891 |
44,804,965 | 2017-06-28T14:11:00.000 | 1 | 0 | 1 | 0 | python,numpy | 44,805,286 | 2 | false | 0 | 0 | Because you are working with a numpy array, which was seen as a C array, size refers to how big your array will be. Moreover, if you can pass np.zeros(10) or np.zeros((10)). While the difference is subtle, size passed this way will create you a 1D array. You can give size=(n1, n2, ..., nn) which will create an nD array... | 1 | 19 | 1 | I noticed that some numpy operations take an argument called shape, such as np.zeros, whereas some others take an argument called size, such as np.random.randint. To me, those arguments have the same function and the fact that they have different names is a bit confusing. Actually, size seems a bit off since it really ... | numpy: "size" vs. "shape" in function arguments? | 0.099668 | 0 | 0 | 17,837 |
44,807,014 | 2017-06-28T15:37:00.000 | 0 | 0 | 1 | 0 | python,regex | 44,807,499 | 3 | false | 0 | 0 | I believe a regex like this is what you're looking for: \s(\d+)\s | 1 | 0 | 0 | I am having issues capturing integers and dates correctly with regular expressions.
Integers
int_test: "Today is 6/28/2017 with 17.5 percent chance of rain"
int_pattern = re.findall(r'\d[0-9].*', int_test)
The problem I am having with this regular expression, it is capturing the the "6, 28, 2017, 17, and 5" from the i... | Capturing integers/dates with regular expressions | 0 | 0 | 0 | 88 |
44,807,243 | 2017-06-28T15:47:00.000 | 0 | 0 | 1 | 0 | python,spss | 44,815,451 | 1 | true | 0 | 0 | The basic idea is to use the spss.Submit API to run regular commands but wrapped in OMS commands so that you can get their output as a dataset or xml structure. You can keep this output from appearing at all in the Viewer, or you can let it appear.
If it is elaborate, you might, as Andy said, want to make it an extens... | 1 | 0 | 0 | I want to create a custom dialog box in SPSS to implement a new procedure that I developed. I have written the Python code for it and am now looking into creating the custom dialog box.
However, my procedure uses the regression coefficients from a data set that are derived from the built-in regression procedure. Since... | Using information from built-in procedure SPSS for custom procedure | 1.2 | 0 | 0 | 34 |
44,810,259 | 2017-06-28T18:42:00.000 | 0 | 0 | 0 | 0 | python,django,forms | 44,810,611 | 1 | false | 1 | 0 | This can only be done using JavaScript. The hard part is to have the management form sync up with the number of rows.
But there's two alternatives:
Semi-javascript (Mezzanine's approach): Generate a ton of rows in the formset and only show one empty. Upon the click of the "add another row" button, unhide the next one.... | 1 | 1 | 0 | I am trying to create a model via a form that has multiple other models related to it. Say I have a model Publisher, then another model Article with a foreign key to Publisher. When creating a Publisher via a form, I want to create An article at the same time. I know how to do this via formsets. However, I don't know ... | Option to add extra choices in django form | 0 | 0 | 0 | 56 |
44,810,388 | 2017-06-28T18:50:00.000 | 1 | 0 | 0 | 0 | python,social-networking,networkx | 44,811,313 | 1 | false | 0 | 0 | I found the feature I'm looking for like, right after I posted this. It is the networkx ego_graph feature. networkx.github.io/documentation/networkx-1.10/reference/ | 1 | 1 | 0 | I want to choose any given node and build a subgraph for that node based on what distance degree I want. I need to input a node's ID, and specify the degree ( 1 = only direct friends, 2 = direct friends, and friends of friends, 3 = direct friends, friends of friends, friends of friends of friends and so on...) and gene... | Generating NetworkX subgraphs based on distance | 0.197375 | 0 | 1 | 169 |
44,811,520 | 2017-06-28T19:58:00.000 | 1 | 0 | 0 | 0 | python-3.x,qt,tkinter,tk | 62,209,717 | 1 | true | 0 | 1 | tkinter based GUI should be smaller on the disk and RAM but has less capabilities and may not suite your needs depending on what you need. tkinter is best for a small, simple gui. it will have no problems running a fair sized document. | 1 | 7 | 0 | BACKGROUND:
It's important to consider memory usage of applications on ARM computers like the Raspberry Pi. When programming with Python, there are several GUI choices. A couple of the most popular are QT and TK. The Raspberry Pi 2 and 3 are limited by 1-Gbyte RAM, and 32-Gbyte max USB memory storage, per stick. T... | Memory savings of Python Tkinter GUI vs PyQT | 1.2 | 0 | 0 | 1,089 |
44,812,538 | 2017-06-28T21:05:00.000 | 7 | 1 | 0 | 0 | python,coverage.py | 44,812,727 | 4 | true | 0 | 0 | Use --include to only include files in particular directories. It matches file paths, so it can match a subdirectory. | 3 | 14 | 0 | I have a directory tests that includes a lot of different tests named test_*.
I tried to run coverage run tests but it doesn't work.
How can I run a single command to coverage multiple files in the directory? | How to run coverage.py on a directory? | 1.2 | 0 | 0 | 16,132 |
44,812,538 | 2017-06-28T21:05:00.000 | 10 | 1 | 0 | 0 | python,coverage.py | 44,812,899 | 4 | false | 0 | 0 | You can achieve that using --source. For example: coverage run --source=tests/ <run_tests> | 3 | 14 | 0 | I have a directory tests that includes a lot of different tests named test_*.
I tried to run coverage run tests but it doesn't work.
How can I run a single command to coverage multiple files in the directory? | How to run coverage.py on a directory? | 1 | 0 | 0 | 16,132 |
44,812,538 | 2017-06-28T21:05:00.000 | 15 | 1 | 0 | 0 | python,coverage.py | 55,546,164 | 4 | false | 0 | 0 | Here is a complete example with commands from the same PWD for all phases in one place. With a worked up example, I am also including the testing and the report part for before and after coverage is run. I ran the following steps and it worked all fine on osx/mojave.
Discover and run all tests in the test directory
... | 3 | 14 | 0 | I have a directory tests that includes a lot of different tests named test_*.
I tried to run coverage run tests but it doesn't work.
How can I run a single command to coverage multiple files in the directory? | How to run coverage.py on a directory? | 1 | 0 | 0 | 16,132 |
44,812,996 | 2017-06-28T21:41:00.000 | 1 | 0 | 1 | 0 | java,python,algorithm,indentation | 44,814,671 | 1 | true | 0 | 0 | The way I see it, there's two distinct ways that you can solve this question.
Convert the python code to some intermediary format which resembles a Context-Free Grammar (CFG) and then perform the error checking on the CFG.
Case checking.
The former is a little more elegant and revolves around compiler theory, or at t... | 1 | 1 | 0 | I was recently interviewed with a local tech company for Java developer role and was asked to write a Java program to check the correctness of indentation in python code (at least find the first indentation error).
It may be easier to deal with def, while and for. However it is tricky to handle things like if...elif...... | How to implement an algorithm to check Python'code's indentation | 1.2 | 0 | 0 | 1,100 |
44,813,676 | 2017-06-28T22:43:00.000 | 0 | 0 | 0 | 0 | python,networking,dependencies | 44,813,734 | 1 | true | 0 | 0 | Try to connect, and if it fails after n retries, consider you don't have a connection.
There are many strategies to setup retries, so search about it to figure what is best for you.
Then if you can't connect, just keep going on after the failure...
That's about it. | 1 | 0 | 0 | I have a python program that handles sensor data. Most of the functionality takes place locally and requires no network connection. The one thing i want it to do with a client is send a continuous stream of data IF a client is connected but for everything else to run regardless of weather there is a connected client or... | Python run certain functions with or without a client connection | 1.2 | 0 | 1 | 41 |
44,814,719 | 2017-06-29T00:55:00.000 | 0 | 0 | 1 | 0 | python | 71,638,920 | 4 | false | 0 | 0 | Any immutable can be dictionary key. like string , number, tuple etc.
the type which cannot be keys are mutable entity like list, set etc. | 1 | 22 | 0 | Can both the values and keys of a dictionary be integers in python? Or do I need one of them to be like a string or something? | Can both the values and keys of a dictionary be integers? | 0 | 0 | 0 | 70,880 |
44,819,809 | 2017-06-29T08:19:00.000 | 0 | 0 | 0 | 1 | python,workflow,pipeline,airflow,apache-airflow | 44,886,741 | 1 | false | 0 | 0 | There is an option to set maximum number of runs per dag in the global airflow.cfg file. The parameter to set is max_active_runs_per_dag. | 1 | 1 | 0 | When i backfill a dag for specific dates, i want to run it by sequentially, i.e. i want it to be run day by day
completing all the tasks for the specific day and then next day so on.. I have used the depends_on_past argument, but it is only helping me to set the dependency on tasks not in dag runs.
example :- Dag_A ha... | airflow backfilling dag run dependancy | 0 | 0 | 0 | 522 |
44,823,132 | 2017-06-29T10:51:00.000 | 4 | 0 | 0 | 0 | python,django,django-views,django-generic-views | 44,823,316 | 3 | false | 1 | 0 | These are completely different things.
get_context_data() is used to generate dict of variables that are accessible in template. queryset is Django ORM queryset that consists of model instances
Default implementation of get_context_data() in ListView adds return value of get_queryset() (which simply returns self.querys... | 1 | 4 | 0 | What is the difference between get_context_data and queryset in Django generic views? They seem to do the same thing? | Diference between get_context_data and queryset in Django generic views? | 0.26052 | 0 | 0 | 3,102 |
44,824,517 | 2017-06-29T11:57:00.000 | -1 | 0 | 0 | 0 | mysql,python-2.7,mariadb | 54,635,754 | 2 | false | 0 | 0 | dumpcmd = "mysqldump -h " + DB_HOST + " -u " + DB_USER + " -p" + DB_USER_PASSWORD + " " + DB_NAME + "| pv | gzip > " + pipes.quote(
BACKUP_PATH) + "/" + FILE_NAME + ".sql" | 1 | 2 | 0 | i'm developing an app for my company, using Python2.7 and MariaDB. I have created a functions which backups our main database server to another database server. I use this command to do it:mysqldump -h localhost -P 3306 -u root -p mydb | mysql -h bckpIPsrv -P 3306 -u root -p mydb2 .
I want to know if it's posible to ... | is there a way to have mysqldump progress bar which shows the users the status of their backups? | -0.099668 | 1 | 0 | 6,336 |
44,825,336 | 2017-06-29T12:36:00.000 | 1 | 0 | 0 | 0 | python,flask,eve | 44,917,195 | 2 | false | 1 | 0 | If your flask app is only for serving static files, you don't even need a flask app. You may be able to directly serve static assets via Nginx | 1 | 1 | 0 | I want to provide REST interface and a single page JS-application for consuming the REST-service. Is there a way to do both in one python app or should I start eve-app for providing REST and flask-app for providing HTML as two processes? | Using Eve and Flask in one application | 0.099668 | 0 | 0 | 806 |
44,827,624 | 2017-06-29T14:14:00.000 | 7 | 0 | 1 | 0 | python,virtualenv,requirements.txt | 44,827,829 | 2 | true | 0 | 0 | While it is technically possible I don't find any good reason to that. Having both is confusing because it is not clear which one is the "master". And you have to (or not?) worry about consistency between installed packages and requirements.txt file.
Also venv and installed packages in many cases depend on the underlyi... | 2 | 5 | 0 | I downloaded a Python project and it contains both a virtual environment and a requirements.txt file. Why would you need both? As far as I know, virtual environments already contain the required modules. Any idea when and why this combination would be useful? | Why would you create a requirements.txt file in a virtual environment in Python? | 1.2 | 0 | 0 | 2,159 |
44,827,624 | 2017-06-29T14:14:00.000 | 1 | 0 | 1 | 0 | python,virtualenv,requirements.txt | 44,827,676 | 2 | false | 0 | 0 | You can't distribute the virtualenv directory with your project because the contents may vary depending on the target operating system and the version of the operating system. Specifically, a virtualenv that includes libraries with compiled components installed on Ubuntu 14.04 will differ from the equivalent virtualenv... | 2 | 5 | 0 | I downloaded a Python project and it contains both a virtual environment and a requirements.txt file. Why would you need both? As far as I know, virtual environments already contain the required modules. Any idea when and why this combination would be useful? | Why would you create a requirements.txt file in a virtual environment in Python? | 0.099668 | 0 | 0 | 2,159 |
44,828,905 | 2017-06-29T15:09:00.000 | 0 | 0 | 0 | 0 | python,pandas | 44,830,094 | 2 | false | 0 | 0 | "Quick" in terms of what resource? If you want programming ease, then simply make a new frame resulting from subtracting adjacent columns. Any entry of zero or negative value is your target.
If you need execution speed, do note that adjacent differences are still necessary: all you can save is the overhead of finding... | 1 | 2 | 1 | I have a pandas dataframe with Datetime as index. The index is generally monotonically increasing however there seem to be a few rows don't follow this tread. Any quick way to identify these unusual rows? | find non-monotonical rows in dataframe | 0 | 0 | 0 | 759 |
44,829,186 | 2017-06-29T15:21:00.000 | 0 | 0 | 0 | 0 | python,rest,reactjs,web-applications,websocket | 44,830,106 | 1 | false | 1 | 0 | Here's a simple way I'd go about doing it:
Create a backend service that exposes the python script's output via HTTP. You can use any familiar backend programming language: python, java, .net etc to host a simple http web server, and expose the data.
Create a simple html page, that makes an ajax call to your backend ... | 1 | 0 | 0 | I have a python script that continuously generates JSON object
{ time: "timestamp", behaviour: 'random behaviour'} and display it on stdout.
Now I want to build a web app and modify the script so that I can read continous data to my web page. I donno where to start from.
Well in details: I want a web API to have an on... | Web App to read data continously from another app | 0 | 0 | 1 | 38 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.