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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35,726,948 | 2016-03-01T15:32:00.000 | 5 | 0 | 0 | 1 | python,celery,flower | 38,764,411 | 2 | false | 1 | 0 | You can use the persisent option,eg: flower -A ctq.celery --persistent=True | 1 | 5 | 0 | I am building a framework for executing tasks on top of Celery framework.
I would like to see the list of recently executed tasks (for the recent 2-7 days).
Looking on the API I can find app.backend object, but cannot figure out how to make a query to fetch tasks.
For example I can use backends like Redis or database. ... | Celery task history | 0.462117 | 0 | 0 | 4,109 |
35,731,339 | 2016-03-01T19:08:00.000 | 0 | 0 | 0 | 0 | python,arrays,performance | 35,731,697 | 2 | true | 0 | 0 | It depends on your requirement. If you pass an array to the function, python passes the reference of that array. Whereas if you pass the array in the form of unpacked arguments, objects comprising the array is passed.
Within the function if the order of your original array is not getting modified, it is better to pass... | 2 | 0 | 1 | Sorry in advance, I know almost nothing about efficiency, so I might need a little extra help.
I have a function that calls another function and it passes in pretty big arrays. Due to limitations in memory, I've just been saving the arrays to pickle files and unpickling inside the second function. Just for context, I ... | Efficiency of passing arrays to a function vs unpickling the array inside the function in Python? | 1.2 | 0 | 0 | 45 |
35,731,339 | 2016-03-01T19:08:00.000 | 0 | 0 | 0 | 0 | python,arrays,performance | 35,732,141 | 2 | false | 0 | 0 | If you memory limitations doesn't allow to keep all files in memory, you will read the file each time and pass list to another function (it will be passed by reference). | 2 | 0 | 1 | Sorry in advance, I know almost nothing about efficiency, so I might need a little extra help.
I have a function that calls another function and it passes in pretty big arrays. Due to limitations in memory, I've just been saving the arrays to pickle files and unpickling inside the second function. Just for context, I ... | Efficiency of passing arrays to a function vs unpickling the array inside the function in Python? | 0 | 0 | 0 | 45 |
35,731,438 | 2016-03-01T19:13:00.000 | 1 | 0 | 0 | 0 | python,django | 35,732,320 | 2 | false | 1 | 0 | Python\Django is modular.
App should include just those models which usually solve 1 concrete task.
If some of models from p.1 can be usefull in other tasks, then probably would be better to create a new apps for those models. Ie if some models are shared between multiple tasks then there is a logic to make a new apps... | 1 | 2 | 0 | I'm build a Django app with a number of models (5-10). There would be an admin side, where an end-user manages the data, and then a user side, where other end-users can only read the data. I understand the point of a Django app is to encourage modularity, but I'm unsure as to "where the line is drawn" so-to-speak.
In ... | Django - What constitutes an app? | 0.099668 | 0 | 0 | 100 |
35,732,758 | 2016-03-01T20:25:00.000 | 1 | 0 | 0 | 0 | mysql,django,python-3.x,django-database | 35,777,867 | 2 | false | 1 | 0 | So here is the answer for all the django (or coding in general) noobs like me.
python manage.py createcachetable
I totally forgot about that and this caused all the trouble with "app_cache doesn't exist". At least in this case...
I changed my database to PostgreSQL, but I am sure it also helps with MySQL... | 2 | 0 | 0 | Hello everybody this is my first post,
I made a website with Django 1.8.9 and Python 3.4.4 on Windows 7. As I was using SQLite3 everything was fine.
I needed to change the database to MySQL. I installed MySQL 5.6 and mysqlclient. I changed the database settings and made the migration ->worked.
But when I try to registe... | Django - MySQL : 1146 Table doesn't exist | 0.099668 | 1 | 0 | 2,782 |
35,732,758 | 2016-03-01T20:25:00.000 | 0 | 0 | 0 | 0 | mysql,django,python-3.x,django-database | 35,733,218 | 2 | false | 1 | 0 | I would assume this was an issue with permissions. As in the web-page connects with a user that doesn't have the proper permissions to create content.
If your tables are InnoDB, you'll get the table doesn't exist message. You need the ib* files in the root of the MySQL datadir (e.g. ibdata1, ib_logfile0 ib_logfile1)
If... | 2 | 0 | 0 | Hello everybody this is my first post,
I made a website with Django 1.8.9 and Python 3.4.4 on Windows 7. As I was using SQLite3 everything was fine.
I needed to change the database to MySQL. I installed MySQL 5.6 and mysqlclient. I changed the database settings and made the migration ->worked.
But when I try to registe... | Django - MySQL : 1146 Table doesn't exist | 0 | 1 | 0 | 2,782 |
35,735,669 | 2016-03-01T23:26:00.000 | 4 | 0 | 1 | 0 | python-3.x,python-3.5,decompiler | 46,968,054 | 3 | false | 0 | 0 | To decompile compiled .pyc python3 files, I used uncompyle6 in my current Ubuntu OS as follows:
(i)Installation of uncompyle6:
pip3 install uncompyle6
(ii)To create a .py file from .pyc file Run:
uncompyle6 -o . your_filename.pyc
(iii)Automatically a new .py file will be created with the same existing .pyc file name.
H... | 1 | 6 | 0 | I have been searching around and haven't been able to find anything that can help me to decompile Python 3.5. Does anyone know of one? | How do I decompile Python 3.5 .pyc? | 0.26052 | 0 | 0 | 22,171 |
35,737,093 | 2016-03-02T02:03:00.000 | 0 | 0 | 0 | 0 | python,function,language-features,pos-tagger,crf | 38,946,931 | 1 | false | 0 | 0 | i recommend use CRF tagger, it's very easy. | 1 | 0 | 0 | I am using CRF POS Tagger in Python, training English PTB sample corpus and the result is quite good.
Now I want to use CRF to train on a large Vietnamese corpus. I need to add some Vietnamese features into this tagger like proper name, date-time, number,... I tried for days but cannot figure out how to do that. I alre... | How to add specific features to CRF POS Tagger in Python? | 0 | 0 | 0 | 293 |
35,737,188 | 2016-03-02T02:13:00.000 | 0 | 0 | 1 | 0 | python-2.7,anaconda,pyinstaller | 47,044,598 | 2 | false | 0 | 1 | Try using the --hidden-import=matplotlib when calling pyinstaller. For example, in the command prompt you would type:
Pyinstaller --hidden-import=matplotlib your_filename_here.py
and you could try giving it a shot with tkinter in there as well.
Pyinstaller --hidden-import=matplotlib --hidden-import=tkinter your_filenam... | 1 | 1 | 0 | I am using Pyinstaller (after spending a long time with py2exe) to convert my REAL.py file to .exe. I used Anaconda to make .py file which is running perfectly on my computer. But when I make .exe file, it shows no error and an application is created in dist\REAL folder. But when I run the .exe file, the console opens... | Pyinstaller with Tkinter Matplotlib numpy scipy | 0 | 0 | 0 | 2,158 |
35,738,199 | 2016-03-02T03:54:00.000 | 0 | 0 | 0 | 0 | python,matplotlib,histogram | 60,751,250 | 9 | false | 0 | 0 | If you are working with pandas, make sure the data you passed in plt.hist() is a 1-d series rather than a dataframe. This helped me out. | 3 | 17 | 1 | I'm plotting about 10,000 items in an array. They are of around 1,000 unique values.
The plotting has been running half an hour now. I made sure rest of the code works.
Is it that slow? This is my first time plotting histograms with pyplot. | Matplotlib.pyplot.hist() very slow | 0 | 0 | 0 | 21,439 |
35,738,199 | 2016-03-02T03:54:00.000 | 0 | 0 | 0 | 0 | python,matplotlib,histogram | 58,707,409 | 9 | false | 0 | 0 | For me it took calling figure.canvas.draw() after the call to hist to update immediately, i.e. hist was actually fast (discovered that after timing it), but there was a delay of a few seconds before figure was updated. I was calling hist inside a matplotlib callback in a jupyter lab cell (qt5 backend). | 3 | 17 | 1 | I'm plotting about 10,000 items in an array. They are of around 1,000 unique values.
The plotting has been running half an hour now. I made sure rest of the code works.
Is it that slow? This is my first time plotting histograms with pyplot. | Matplotlib.pyplot.hist() very slow | 0 | 0 | 0 | 21,439 |
35,738,199 | 2016-03-02T03:54:00.000 | 2 | 0 | 0 | 0 | python,matplotlib,histogram | 56,879,388 | 9 | false | 0 | 0 | For me, the problem is that the data type of pd.Series, say S, is 'object' rather than 'float64'. After I use S = np.float64(S), then plt.hist(S) is very quick. | 3 | 17 | 1 | I'm plotting about 10,000 items in an array. They are of around 1,000 unique values.
The plotting has been running half an hour now. I made sure rest of the code works.
Is it that slow? This is my first time plotting histograms with pyplot. | Matplotlib.pyplot.hist() very slow | 0.044415 | 0 | 0 | 21,439 |
35,741,698 | 2016-03-02T08:14:00.000 | 1 | 0 | 0 | 0 | python,dxf | 36,529,617 | 2 | true | 0 | 0 | dxfgrabber and ezdxf are just interfaces to the DXF format and do not provide any kind of CAD or calculation functions, and the geometrical length of DXF entities are not available attributes in the DXF format. | 1 | 3 | 0 | I am trying to find total length(perimeter),area of a spline from dxf file.
Is there any function in dxfgrabber or ezdxf to find total length of an entity from dxf file ? | how to find length of entity from dxf file using dxfgrabber or ezdxf packages | 1.2 | 0 | 0 | 3,245 |
35,742,024 | 2016-03-02T08:33:00.000 | 5 | 0 | 1 | 0 | python,python-2.7,modulo | 35,742,052 | 1 | false | 0 | 0 | Since * and % have exactly the same precedence, associativity comes into play. Since both operators are evaluated from left to right (i.e. the associativity is from left to right), your expression is equivalent to
(25 * 3) % 4
which is, of course, 75 % 4 which is also 3. | 1 | 2 | 0 | going through a tutorial I've learnt that the modulus function returns the remainder of the equation. Thus, for example, 3 % 4 equals 3
But I don't seem to understand how 25 * 3 % 4 = 3. What's happened to 25?
I've run the script on PowerShell as well as online Google calculator, returns the same. Anyone willing to ex... | Use of % modulo function | 0.761594 | 0 | 0 | 99 |
35,742,472 | 2016-03-02T08:56:00.000 | 0 | 0 | 0 | 0 | python,plugins,qgis | 35,810,383 | 2 | false | 0 | 0 | You could add the qgis plugin folder to your path. That way you should be able to import them as a module. | 1 | 4 | 0 | I would like to access external qgis plugins through a python script. I have been able to access the built in qgis processing and vector toolboxs, but have been unsuccessful with external plugins such as the topology checker plugin. I have tried this both using the built in qgis python console, and an exteranl IDE, but... | How to run QGIS plugin from python script | 0 | 0 | 0 | 2,798 |
35,742,708 | 2016-03-02T09:08:00.000 | 1 | 1 | 0 | 0 | python,c,html,websocket,autobahn | 35,795,470 | 1 | false | 1 | 0 | Autobahn|Python provides both a WebSocket implementation for Python and an implementation for a client for the WAMP protocol on top of that.
You can use the WebSocket part on its own to implement your WebSocket server. | 1 | 0 | 0 | I'm researching about WebSockets atm and just found Autobahn with Autobahn|Python.
I'm not sure that I understand the function of that toolset (?) correctly.
My intention is to use a WebSocket-Server for communication between a C program and a HTML client.
The idea is to let the C program connect via WebSocket to the ... | Is the following principle the right for autobahn python? | 0.197375 | 0 | 1 | 59 |
35,749,102 | 2016-03-02T13:51:00.000 | 0 | 0 | 1 | 0 | python,python-jedi | 36,939,902 | 3 | false | 0 | 0 | This is currently not something that is supported in Jedi. You could certainly do it, but not with the public API. There are two things that Jedi's API is currently missing:
Getting the class/function by position (You can get this by playing with jedi's Parser).
Getting the code once you have your class. This is very ... | 1 | 0 | 0 | Basically I want to use jedi to retrieve a function's or a class' code from the details of it's definition(s) (path, line, column). To be more explicit, what I really wish is to get the code from a file, that is not executed, static. | Get a function/class code from a file knowing the line and the column of it's definition | 0 | 0 | 0 | 53 |
35,750,276 | 2016-03-02T14:39:00.000 | 2 | 0 | 0 | 1 | python,macos,pip,homebrew,pyaudio | 35,867,245 | 2 | true | 0 | 0 | You can try export MACOSX_DEPLOYMENT_TARGET='desired value' in Terminal just before you run the installation process. | 1 | 2 | 0 | I used brew to install port audio.
I then tried pip install pyaudio.
I get:
error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "10.11" during configure
How can I set the MACOSX_DEPLOYMENT_TARGET so that I don't get this error? | Trying to install PyAudio on OS X ( 10.11.3) | 1.2 | 0 | 0 | 345 |
35,755,572 | 2016-03-02T18:45:00.000 | 32 | 0 | 1 | 0 | python,visual-studio,visual-studio-2015 | 37,321,206 | 3 | false | 0 | 0 | Tools -> Options -> Text editor -> Python -> Tabs and set it to Smart | 1 | 18 | 0 | This is probably a simple issue but something is wrong with my Python tools for visual studio. When I first started using VS2015 for Python it would auto-indent whenever I used a colon. Now VS2015 is just acting like a text editor with syntax highlighting. I tried uninstalling and reinstalling the Python tools but that... | Visual Studio, Python not auto-indenting | 1 | 0 | 0 | 12,572 |
35,758,928 | 2016-03-02T21:56:00.000 | 1 | 0 | 1 | 0 | python,virtualenv | 35,759,297 | 1 | false | 0 | 0 | virtualenv is a good option if you are transferring the folder between two same operating systems.
In order to include the correspond site packages that are already installed in your computer, install them inside the virtualenv context by doing pip install in the virtualenv shell.
You could use pip freeze to get a list... | 1 | 1 | 0 | So I develop a python application and I plan to copy the whole folder for my friend to use it as end-user.
But my friend does not have python installed in the computer and I don't want to make them install it since he is not a developer.
In my project I have set up the virtualenv with python.exe inside it but without ... | Copy Python project folder to computer without python, can I run it? | 0.197375 | 0 | 0 | 950 |
35,763,357 | 2016-03-03T04:42:00.000 | 3 | 1 | 0 | 1 | python,datetime,unix,timestamp,epoch | 35,763,677 | 5 | false | 0 | 0 | Well, there are 946684800 seconds between 2000-01-01T00:00:00Z and 1970-01-01T00:00:00Z. So, you can just set a constant for 946684800 and add or subtract from your Unix timestamps.
The variation you are seeing in your numbers has to do with the delay in sending and receiving the data, and could also be due to clock ... | 1 | 9 | 0 | I am trying to interact with an API that uses a timestamp that starts at a different time than UNIX epoch. It appears to start counting on 2000-01-01, but I'm not sure exactly how to do the conversion or what the name of this datetime format is.
When I send a message at 1456979510 I get a response back saying it was re... | Conversion from UNIX time to timestamp starting in January 1, 2000 | 0.119427 | 0 | 0 | 13,703 |
35,769,905 | 2016-03-03T10:43:00.000 | 1 | 0 | 1 | 0 | python,python-2.7,py2exe,cx-freeze | 35,783,366 | 1 | true | 0 | 0 | The main difference between the two is that py2exe is limited to Windows whereas cx_Freeze is cross-platform and works on Windows, Linux, Mac OS X, etc. If you are only planning on supplying your application to those on Windows then py2exe is a valid option. It also has more Windows specific features that may be of ben... | 1 | 0 | 0 | I want to compile my python program to exe. I know two modules, with the help of which I can do that, they are py2exe and cx-freeze. Can somebody tell me the difference (Does cx-freeze have more features that py2exe because it is from an external source)? Which one is more common among python users? Which one works qui... | Which is more optimal for compiling python 2.7 programs to exe - py2exe or cx-freeze? | 1.2 | 0 | 0 | 84 |
35,773,582 | 2016-03-03T13:31:00.000 | 0 | 0 | 1 | 0 | python | 35,773,683 | 4 | false | 0 | 0 | The % (modulo) sign should help you here:
new = old - (old % 10) | 1 | 1 | 0 | I have the number 67.14, for example.
I need to set another variable as the next multiple of 10 down (60, in this case).
Would it be possible to just get the "7.14" from "67.14" and take it away? | Truncate float to multiple of 10 | 0 | 0 | 0 | 106 |
35,775,144 | 2016-03-03T14:39:00.000 | 0 | 1 | 0 | 0 | python,amazon-web-services,m2crypto | 35,782,735 | 1 | false | 1 | 0 | Device Farm requires your python test should be able to execute on Linux_X64 platform.
You could create and package your test bundle on linux_x64 platform, then try to run it on Device Farm. | 1 | 0 | 0 | I'm working on Python Image Recognition test for Android devices. It works on local; but when I try to build it for AWS, I always get the following error:
copying M2Crypto\SSL__init__.py -> build\lib.win32-2.7\M2Crypto\SSL
running build_ext building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to S... | Python Mobile Test on AWS Device Farm (M2Crypto Issue) | 0 | 0 | 0 | 96 |
35,779,145 | 2016-03-03T17:37:00.000 | 1 | 0 | 1 | 0 | python,kivy | 41,786,561 | 5 | false | 0 | 1 | i have encountered a simillar setback while trying to install kivy on python.
in python version 3, py is used instead of python for launching python in the command prompt i.e
py (to launch python3)
py -m pip install kivy (to install kivy)
N.b: before installing kivy it is recommended to install cython and other pytho... | 1 | 0 | 0 | I have tried following the steps on the website but they're not working for me. At least I must be doing something for them not to work.
Firstly, before the steps, the site tells me to open the command line and type python --version. So I typed on the windows search bar 'command line'. Python (command line) came up and... | How to install kivy on Windows 10 | 0.039979 | 0 | 0 | 12,655 |
35,783,883 | 2016-03-03T21:59:00.000 | 0 | 0 | 1 | 1 | python | 35,783,966 | 1 | false | 0 | 0 | A very good solution would be to build a web app. You can use django, bottle or flask for example.
Your users just connect to your url with a browser. You are in complete control of the code, and can update whenever you want without any action on their part.
They also do not need to install anything in the first place,... | 1 | 0 | 0 | How can I update a python script remotely. I have a program which I would like to share, however it will be frequently updates, therefore I want to be able to remotely update it so that the users do not have to re-install it every day. I have already searched StackOverflow for an answer but I did not find anything I co... | How can I remotely update a python script | 0 | 0 | 0 | 214 |
35,784,155 | 2016-03-03T22:15:00.000 | 1 | 0 | 0 | 0 | python,sql,database,libreoffice,libreoffice-calc | 66,788,273 | 2 | false | 0 | 0 | You can ofcourse use python for this task but it might be an overkill.
The CSV export / import sequence is likely much faster, less error prone and needs less ongoing maintainance (e.g if you change the spreadsheet columns). The sequence is roughly as follows:
select the sheet that you want to import into a DB
select ... | 2 | 0 | 0 | What's the best way to switch to a database management software from LibreOffice Calc?
I would like to move everything from a master spreadsheet to a database with certain conditions. Is it possible to write a script in Python that would do all of this for me?
The data I have is well structured I have about 300 columns... | How to import data from LibreOffice Calc to a SQL database? | 0.099668 | 1 | 0 | 1,516 |
35,784,155 | 2016-03-03T22:15:00.000 | 0 | 0 | 0 | 0 | python,sql,database,libreoffice,libreoffice-calc | 35,784,265 | 2 | true | 0 | 0 | You can create a python script that will read this spreadsheet row by row and then run insert statements in a database. In fact, would be even better if you save the spreadsheet as CSV for example, if you only need the data there. | 2 | 0 | 0 | What's the best way to switch to a database management software from LibreOffice Calc?
I would like to move everything from a master spreadsheet to a database with certain conditions. Is it possible to write a script in Python that would do all of this for me?
The data I have is well structured I have about 300 columns... | How to import data from LibreOffice Calc to a SQL database? | 1.2 | 1 | 0 | 1,516 |
35,785,178 | 2016-03-03T23:30:00.000 | 0 | 0 | 0 | 0 | python,image,matplotlib,plot | 35,886,350 | 1 | true | 0 | 0 | The array is plotted upside-down, meaning the index (0, 0) is at the bottom left. | 1 | 0 | 1 | Every time I go to plot a 2D array in matplotlib using, for example, pcolormesh, I have the same question: Is the resultant image showing the array rightside-up or upside-down? That is, is index (0, 0) at the top left of the plot or the bottom left?
It's tedious to write a test every six months to remind myself. This... | Does pcolormesh plot the 2D array rightside-up or upside-down? | 1.2 | 0 | 0 | 335 |
35,786,499 | 2016-03-04T01:42:00.000 | 5 | 0 | 1 | 0 | python,objectinstantiation | 35,786,569 | 3 | true | 0 | 0 | It doesn't matter how complex the class is; when you create an instance, you only store a reference to the class with the instance. All methods are accessed via this one reference. | 1 | 3 | 0 | I have a program that must continuously create thousands of objects off of a class that has about 12–14 methods. Will the fact that they are of a complex class cause a performance hit over creating a simpler object like a list or dictionary, or even another object with fewer methods?
Some details about my situation:
I ... | python: will an class with many methods take longer to initialize? | 1.2 | 0 | 0 | 505 |
35,786,884 | 2016-03-04T02:24:00.000 | 0 | 0 | 1 | 0 | ipython,ibm-cloud,egg,jupyter-notebook | 36,672,569 | 1 | true | 0 | 0 | Create a zip file with setup script. Put the zip file in object storage. Download zip using http or curl from object storage into bluemix notebook environment. Do pip install for zip file. | 1 | 0 | 0 | How can I add the .egg file to my Jupyter IPython Notebook on Bluemix? I see documentation for adding jars for scala notebooks, but nothing for python egg files. | Add .egg file to Jupyter IPython Notebook on Bluemix | 1.2 | 0 | 0 | 313 |
35,788,298 | 2016-03-04T04:58:00.000 | 1 | 0 | 0 | 0 | android,python,optimization,kivy | 35,795,097 | 1 | false | 0 | 1 | The immediate possibility is that you're just seeing the android processor be slower than the desktop one. I'm not sure what the benchmark comparisons are nowadays, but I've seen this be a problem in the past. That said, I'd have guessed the same as you that the difference shouldn't be that big.
I don't know if it woul... | 1 | 1 | 0 | I'm fairly far along developing a Kivy app. Its targeted for android, but will also work (simultaneously with a different skin) on desktops and hopefully iOs eventually.
The basic dependencies I'm heavily using are:-
twisted - using this as an IPC, my app has a server/client
relationship between the data manipulatio... | Python on android (kivy) - speed bottlenecks for certain operations? | 0.197375 | 0 | 0 | 1,330 |
35,794,831 | 2016-03-04T11:24:00.000 | 1 | 0 | 0 | 0 | javascript,python,ajax,django,django-templates | 35,795,049 | 1 | false | 1 | 0 | The django.test.Client is not a browser, it just makes HTTP requests, thus doesn't know anything about ajax/javascript.
One of the following should help you
use django.test.Client and assert that
the template has the ajax call to the correct url, i.e.: assert that the response contains <script>myAjaxCallTo('/some/ur... | 1 | 0 | 0 | I've faced with some problem during implementing test for template rendering.
There are two views:
General
Block with required data
General(1) template displays some data. This template contains ajax GET call for retrieving data from additional view (2). I want to check these data in my template(1) with test.
I ... | Testing Django template with ajax GET request - ajax request isn't invoking | 0.197375 | 0 | 0 | 277 |
35,798,844 | 2016-03-04T14:44:00.000 | 0 | 1 | 1 | 0 | python | 35,801,829 | 1 | true | 0 | 0 | Install them into a subdirectory of your package directory in site-packages. If the subdirectory doesn't have an __init__.py file or if it's name has a dash (-) or other character that isn't valid in a Python identifier it can't be imported using the import statement nor can any Python file located under it.
So for exa... | 1 | 0 | 0 | I'm working on a package that uses data from external git repository. When it's doing its job, it first cloning git repository and then copies files from it to some other location.
Where should I save this repository (and other non-python files) in my filesystem? Is there any standard place for that?
Sure, I could ju... | Standard directory for installed Python package's data | 1.2 | 0 | 0 | 76 |
35,800,558 | 2016-03-04T16:03:00.000 | 1 | 0 | 0 | 0 | python,django | 35,800,668 | 1 | false | 1 | 0 | The approach what you are following is not correct.
If you want to force the user to change the password, set the flag and if flag is true redirect the user to change the password.
If you kill the user will be redirected to login page by default in any web application.
Thanks. | 1 | 0 | 0 | Periodically, I force some users to log out (because their passwords have to be changed) and for that I delete their Session cookie. What's happening next is that these users are redirected to the login screen.
How could I implement their redirection to a template that the only thing they can do is to change their pass... | Change password form while session is deleted | 0.197375 | 0 | 0 | 30 |
35,800,893 | 2016-03-04T16:17:00.000 | 3 | 0 | 0 | 0 | python,deep-learning,face-recognition,torch | 35,881,615 | 2 | true | 0 | 0 | As I posted in the comments, this segfault was caused by compiling dlib with one Python version and running it with another. This was resolved by manually installing dlib rather than using their pip package. | 1 | 2 | 1 | I am new to deeplearning and face recognition. After searching, I found this python package about deeplearning applied to face recognition called OpenFace. From its documentation, I think it is build on top of Torch for the neural nets computation.
I want to install the package in a virtual environment, so basically th... | Trouble Installing OpenFace in Python | 1.2 | 0 | 0 | 4,278 |
35,801,424 | 2016-03-04T16:41:00.000 | 0 | 0 | 1 | 0 | python,queue | 35,889,996 | 1 | false | 0 | 0 | I am not sure, but hope if this could help.
make a priority queue.
priority will be on the time-stamp on which it was accessed.
(if it was accessed sooner it will have less priority).
{"ip": "time-stamp when it was accessed"}
keep the queue sorted. On top you would have the least recently used ones.
so for 50 days... | 1 | 0 | 0 | I am trying to build a library of about 3000 IP Addresses. They will each be run through a program I have already written separately. It will scan 60 of them a day, so it needs to keep track of which is scanned and put them at the back of the queue.
I'm not looking for you to write the code, just a little bit of a push... | Building a queue in Python | 0 | 0 | 1 | 59 |
35,801,638 | 2016-03-04T16:52:00.000 | 4 | 0 | 0 | 0 | python,pandas,scikit-learn | 35,953,956 | 1 | true | 0 | 0 | Nearly all scikit-learn estimators will convert input data to float before running the algorithm, regardless of the original types in the array. This holds for the random forest implementation. | 1 | 4 | 1 | I was trying to train a randomforest classifier in python. However, in my original pandas.dataframe, there are float64, object, datetime64, int64 and bool dtypes(nearly all kinds of dtypes allowed in pandas).
Is it necessary to convert a bool to float or int?
For a two-value object column, should I convert it to bool... | Which dtype performs better when training a randomforest in python? | 1.2 | 0 | 0 | 1,673 |
35,805,904 | 2016-03-04T20:58:00.000 | 1 | 0 | 0 | 1 | python,visual-studio,opencv,cmake,cmake-gui | 35,806,266 | 1 | false | 0 | 1 | You should look for Python related variables in the CMake GUI. There may be some variables you could set to force paths to the python2.7 interpreter, libs and include dirs. | 1 | 0 | 0 | Recently , I wanted to install OpenCV (in Win10 64 bit ) using Cmake 3.5.0-rc3 and Visual studio 2015 . I have python 3.5 as root and 2.7 as python2 . The issue is while configuring it recognizes python 3.5 as main interpreter but i want it to be 2.7.Is there a possible way to make cmake recognize 2.7 as my main pyth... | Managing OpenCV python Cmake Studio Windows | 0.197375 | 0 | 0 | 102 |
35,809,076 | 2016-03-05T01:57:00.000 | 1 | 0 | 1 | 0 | python,temp | 35,809,112 | 2 | true | 1 | 0 | tempfile.mkstemp creates a file that is normally visible in the filesystem and returns you the path as well. You should be able to use this to create your input and output files - assuming javac will atomically overwrite the output file if it exists there should be no race condition if other processes on your system do... | 1 | 1 | 0 | I have a string of Java source code in Python that I want to compile, execute, and collect the output (stdout and stderr). Unfortunately, as far as I can tell, javac and java require real files, so I have to create a temporary directory.
What is the best way to do this? The tempfile module seems to be oriented towards ... | Python temporary directory to execute other processes? | 1.2 | 0 | 0 | 1,712 |
35,809,944 | 2016-03-05T04:18:00.000 | 0 | 0 | 0 | 0 | python,statistics | 35,810,321 | 1 | false | 0 | 0 | Check wls_prediction_std from statsmodels.sandbox.regression.predstd. | 1 | 0 | 0 | After spending 2 hours of research to no avail, I decided to pose my question here. What is the code to find CI of mean response in python?
I know how to do it in R, but I just don't know what I need to do for Python. I assume statsmodel has a function for that. If so, what is it? | How do I find CI of Mean Response using Python? | 0 | 0 | 0 | 40 |
35,810,213 | 2016-03-05T04:57:00.000 | 1 | 1 | 1 | 0 | python-sphinx | 66,365,397 | 3 | false | 0 | 0 | It is also possible to add this option in the conf.py file.
Search in conf.py for the line where the string containing the sphinx-apidoc command is (located in a try section) and add the "--module-first" option.
The new line will look like this:
cmd_line_template = "sphinx-apidoc --module-first -f -o {outputdir} {modul... | 1 | 12 | 0 | I typically put the high-level documentation for a Python package into the docstring of its __init__.py file. This makes sense to me, given that the __init__.py file represents the package's interface with the outside world. (And, really, where else would you put it?)
So, I was really quite surprised when I fired up ... | Can Sphinx emit the 'module contents' first and the 'submodules' last? | 0.066568 | 0 | 0 | 3,613 |
35,811,941 | 2016-03-05T08:34:00.000 | 0 | 0 | 0 | 0 | python-2.7,anaconda,theano | 42,725,755 | 1 | false | 0 | 1 | get rid of theano and reinstall. If that doesn't work, reinstall all of python | 1 | 0 | 0 | New to Theano when I tried to use the package I keep getting the following error:
ImportError: ('The following error happened while compiling the node', Dot22(, ), '\n', 'dlopen(/Userdir/.theano/compiledir_Darwin-14.3.0-x86_64-i386-64bit-i386-2.7.11-64/tmpEBdQ_0/eb163660e6e45b373cd7909e14efd44a.so, 2): Library not loa... | Running Theano on Python 2.7 | 0 | 0 | 0 | 46 |
35,813,667 | 2016-03-05T11:43:00.000 | 0 | 0 | 1 | 1 | python,python-3.x,new-window,tui | 35,813,975 | 4 | false | 0 | 0 | You may not like this, it's a bit higher level than a basic two player board game, but there is always using some sort of GUI.
I personally like tkinter myself.
You don't want the option of people scrolling up to see printed text, but you can't remove what has been printed, that's like asking a printer to remove ink of... | 1 | 1 | 0 | I'm creating a simple two-player board game where each player must place pieces on their own boards. What I would like to do is by either:
opening a new terminal window (regardless which OS the program is run on) for both players so that the board is saved within a variable but the other player cannot scroll up to see... | Python hide already printed text | 0 | 0 | 0 | 6,322 |
35,816,195 | 2016-03-05T15:51:00.000 | 4 | 0 | 0 | 0 | android,python,kivy | 35,817,419 | 1 | true | 0 | 1 | Yes, It'll work. os works on windows, linux and mac and android is well.. linux. If python runs on it, os will too.
For simple storing you can use os.path.dirname(os.path.abspath(__file__)) and it'll store data in your data/<app>/ or data/data/<app>/ on android, so common user will not access it. Of course if your app ... | 1 | 2 | 0 | I am using kivy to create an android app. However some important pieces of code are based on the python os module. Now since the os is supposed to be system-dependant, i was wondering if it would work on a mobile device running android. If it doesn't work is there some other way to achieve the same results?
Also, the a... | Will python os module work on android? | 1.2 | 0 | 0 | 2,556 |
35,818,003 | 2016-03-05T18:26:00.000 | 1 | 1 | 0 | 1 | python,linux,startup,intel-galileo | 35,972,324 | 1 | true | 0 | 0 | I made the myprogram.py run in background with python myprogram.py & and it worked. The & is used to run whatever process you want in background. | 1 | 2 | 0 | I have a python program that is an infinity loop and send some data to my database.
I want this python script to run when I power my Intel Galileo. I tried to make a sh script python myprogram.py and made it run on startup in etc/init.d. When I restarted my Galileo, nothing happened-Linux didn't load, Arduino sketch di... | Run python program on startup in background on Intel Galileo | 1.2 | 0 | 0 | 259 |
35,820,328 | 2016-03-05T21:48:00.000 | 0 | 0 | 0 | 0 | python,django,apache,lxml,libxslt | 35,821,295 | 1 | false | 1 | 0 | Fixed by removing libexslt.so files from usr/lib64/. | 1 | 0 | 0 | I have a django app that requires Python (3.4) lxml package. I had a fair amount of trouble building the c shared libraries libxslt and libxml2 that lxml depends on in my red hat server environment. However, pip install lxml now completes successfully and I can import and use lxml in the command line interpreter.
When ... | lxml runs in interpreter but not through apache/mod_wsgi | 0 | 0 | 0 | 362 |
35,820,336 | 2016-03-05T21:49:00.000 | 0 | 0 | 0 | 0 | python,pygame,gravity | 35,822,375 | 2 | false | 0 | 1 | Quick dislaimer: I do not know multiple ways to incorporate gravity, so I can not say which is "best". But, if you're fighting the performance battle in Python, you've probably fighting the wrong battle.
For gravity, you can use a vector system. Say a character jumps off the ground and has initial velocity of [5, -15] ... | 1 | 3 | 0 | I'm in the process of making a simple game in pygame. Its looking to be a platformer RPG. But that is neither final or relevant per this question. So far i have very little functionality in the game. Its just a skeleton at this point if that. My question is kind of two fold:
Whats the best (in terms of performance an... | Pygame - Gravity Methods | 0 | 0 | 0 | 238 |
35,823,618 | 2016-03-06T05:47:00.000 | 1 | 0 | 1 | 0 | python,matplotlib,neural-network,ipython,jupyter-notebook | 35,827,519 | 1 | true | 0 | 0 | It doesn't matter. It just runs a Python kernel in the background which is no different from one you would run from the command line.
The only thing you should avoid, obviously, is displaying huge amounts of data in your notebook (like plotting your whole image set at once). | 1 | 3 | 1 | I'm working on a project involving Neural Networks (using theano) with a big data set 50,000 images of 3072 pixels. The computational process gets expensive when training the Neural Network as you may expect.
I was using PyCharm to debug and write the code but since I had some trouble using matplotlib and other librar... | iPython Notebook for big / complex analysis. Good idea or not? | 1.2 | 0 | 0 | 265 |
35,825,802 | 2016-03-06T10:34:00.000 | 10 | 0 | 1 | 0 | python,arrays,list,numpy | 35,825,863 | 1 | true | 0 | 0 | Numpy arrays is a typed array, the array in memory stores a homogenous, densely packed numbers.
Python list is a heterogeneous list, the list in memory stores references to objects rather than the number themselves.
This means that Python list requires dereferencing a pointer every time the code needs to access the nu... | 1 | 13 | 1 | Why do we use numpy arrays in place of lists in python? What is the main difference between them? | What is the difference between a NumPy array and a python list? | 1.2 | 0 | 0 | 17,191 |
35,826,912 | 2016-03-06T12:38:00.000 | 1 | 0 | 0 | 0 | python,pandas,scikit-learn | 35,827,413 | 7 | false | 0 | 0 | IMO the opposite strategy, identifying categoricals is better because it depends on what the data is about. Technically address data can be thought of as unordered categorical data, but usually I wouldn't use it that way.
For survey data, an idea would be to look for Likert scales, e.g. 5-8 values, either strings (whic... | 4 | 28 | 1 | I've been developing a tool that automatically preprocesses data in pandas.DataFrame format. During this preprocessing step, I want to treat continuous and categorical data differently. In particular, I want to be able to apply, e.g., a OneHotEncoder to only the categorical data.
Now, let's assume that we're provided a... | What is a good heuristic to detect if a column in a pandas.DataFrame is categorical? | 0.028564 | 0 | 0 | 13,722 |
35,826,912 | 2016-03-06T12:38:00.000 | 5 | 0 | 0 | 0 | python,pandas,scikit-learn | 35,827,781 | 7 | false | 0 | 0 | There's are many places where you could "steal" the definitions of formats that can be cast as "number". ##,#e-# would be one of such format, just to illustrate. Maybe you'll be able to find a library to do so.
I try to cast everything to numbers first and what is left, well, there's no other way left but to keep them ... | 4 | 28 | 1 | I've been developing a tool that automatically preprocesses data in pandas.DataFrame format. During this preprocessing step, I want to treat continuous and categorical data differently. In particular, I want to be able to apply, e.g., a OneHotEncoder to only the categorical data.
Now, let's assume that we're provided a... | What is a good heuristic to detect if a column in a pandas.DataFrame is categorical? | 0.141893 | 0 | 0 | 13,722 |
35,826,912 | 2016-03-06T12:38:00.000 | 1 | 0 | 0 | 0 | python,pandas,scikit-learn | 35,828,098 | 7 | false | 0 | 0 | I think the real question here is whether you'd like to bother the user once in a while or silently fail once in a while.
If you don't mind bothering the user, maybe detecting ambiguity and raising an error is the way to go.
If you don't mind failing silently, then your heuristics are ok. I don't think you'll find any... | 4 | 28 | 1 | I've been developing a tool that automatically preprocesses data in pandas.DataFrame format. During this preprocessing step, I want to treat continuous and categorical data differently. In particular, I want to be able to apply, e.g., a OneHotEncoder to only the categorical data.
Now, let's assume that we're provided a... | What is a good heuristic to detect if a column in a pandas.DataFrame is categorical? | 0.028564 | 0 | 0 | 13,722 |
35,826,912 | 2016-03-06T12:38:00.000 | 1 | 0 | 0 | 0 | python,pandas,scikit-learn | 38,108,924 | 7 | false | 0 | 0 | I've been thinking about a similar problem and the more that I consider it, it seems that this itself is a classification problem that could benefit from training a model.
I bet if you examined a bunch of datasets and extracted these features for each column / pandas.Series:
% floats: percentage of values that are fl... | 4 | 28 | 1 | I've been developing a tool that automatically preprocesses data in pandas.DataFrame format. During this preprocessing step, I want to treat continuous and categorical data differently. In particular, I want to be able to apply, e.g., a OneHotEncoder to only the categorical data.
Now, let's assume that we're provided a... | What is a good heuristic to detect if a column in a pandas.DataFrame is categorical? | 0.028564 | 0 | 0 | 13,722 |
35,827,446 | 2016-03-06T13:30:00.000 | 2 | 0 | 0 | 0 | python,scikit-learn,random-forest,subsampling | 35,847,976 | 4 | false | 0 | 0 | Certainly not all samples are selected for each tree. Be default each sample has a 1-((N-1)/N)^N~0.63 chance of being sampled for one particular tree and 0.63^2 for being sampled twice, and 0.63^3 for being sampled 3 times... where N is the sample size of the training set.
Each bootstrap sample selection is in average ... | 1 | 6 | 1 | In the documentation of SciKit-Learn Random Forest classifier , it is stated that
The sub-sample size is always the same as the original input sample size but the samples are drawn with replacement if bootstrap=True (default).
What I dont understand is that if the sample size is always the same as the input sample ... | How can SciKit-Learn Random Forest sub sample size may be equal to original training data size? | 0.099668 | 0 | 0 | 3,033 |
35,834,903 | 2016-03-07T01:39:00.000 | 5 | 1 | 0 | 0 | python,audio | 36,206,031 | 4 | false | 0 | 0 | Hello After alot of trial and error I final solved it on the pip install sounddevice --user.
You need to remove --user part so that the command is: pip install sounddevice . This installs it through out the entire system and works. | 2 | 4 | 0 | I have python code that is running on raspberry pi B++ that uses the sounddevice library that lets you play and record sounds with python. I have successfully installed the modules. I can confirm through the python command line and enter import sounddevice as sd is works without errors. I have also confirmed by typing ... | Python import sounddevice as sd (ImportError: No module name sounddevice) | 0.244919 | 0 | 0 | 14,295 |
35,834,903 | 2016-03-07T01:39:00.000 | 0 | 1 | 0 | 0 | python,audio | 62,490,236 | 4 | false | 0 | 0 | I had this same problem on Windows 10 even after eliminating the --user part of the pip install command. For some reason, installing pyaudio first resolved the problem with sounddevice. Sounddevice continues to work even after uninstalling pyaudio. They're both based on Portaudio so perhaps there's something shared ... | 2 | 4 | 0 | I have python code that is running on raspberry pi B++ that uses the sounddevice library that lets you play and record sounds with python. I have successfully installed the modules. I can confirm through the python command line and enter import sounddevice as sd is works without errors. I have also confirmed by typing ... | Python import sounddevice as sd (ImportError: No module name sounddevice) | 0 | 0 | 0 | 14,295 |
35,835,274 | 2016-03-07T02:32:00.000 | 2 | 0 | 1 | 0 | python,virtualenv,anaconda | 59,508,454 | 3 | true | 0 | 0 | In case anyone is coming back to this now, for conda 4.7.12, entering export PYTHONNOUSERSITE=True before the conda activate call successfully isolated the conda environment from global/user site packages for me.
On the other hand, entering export PYTHONNOUSERSITE=0 allows the conda environment to be reintroduced to th... | 1 | 10 | 0 | I have a project called ABC, I have a conda env just for it in the fold ~/anaconda/envs/ABC, I believe it is a venv, and I want to use some specific packages from the global site packages.
For normal Python installation it can be done be removing the no-global-site-package.txt from the venv folder, or by setting the ve... | how to reuse global site-packages in conda env | 1.2 | 0 | 0 | 14,872 |
35,835,787 | 2016-03-07T03:39:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,svm,libsvm,prediction | 35,836,274 | 1 | false | 0 | 0 | The file "trainingdata.svm.prediction" is predicting the labels 1 and 0 for your set (1 means the sample was predicted to be male, 0 is female).
It assumes all the labels belong to class index 0, I believe. | 1 | 0 | 1 | I am using the LIBSVM for the first time.
I was able to train a data(for images) and my model is ready "trainingdata.svm.model"
Now, when I run my classification against an unknown test data it is giving me two files:
1. trainingdata.svm.prediction (This file contains 1's and 0's) against my each of test data.
2. It is... | How is "accuracy" calculated using Libsvm - SVM_Predict.exe | 0 | 0 | 0 | 190 |
35,837,243 | 2016-03-07T06:09:00.000 | 6 | 0 | 0 | 0 | python,python-2.7,hdf5,h5py,hdf | 46,668,033 | 1 | false | 0 | 0 | Declaration up front: I help maintain h5py, so I probably have a bias etc.
The wikipedia page has changed since the question was posted, here's what I see:
Criticism
Criticism of HDF5 follows from its monolithic design and lengthy specification.
Though a 150-page open standard, the only other C implementation of HDF5... | 1 | 8 | 1 | On wikipedia one can read the following criticism about HDF5:
Criticism of HDF5 follows from its monolithic design and lengthy
specification. Though a 150-page open standard, there is only a single
C implementation of HDF5, meaning all bindings share its bugs and
performance issues. Compounded with the lack of j... | HDF5 possible data corruption or loss? | 1 | 0 | 0 | 1,980 |
35,841,555 | 2016-03-07T10:38:00.000 | 2 | 1 | 0 | 0 | python,ionic-framework,backend,hybrid-mobile-app | 35,842,202 | 2 | false | 0 | 0 | Yes, you can use python using django rest framework as a backend for your ionic app.... | 2 | 8 | 0 | Can I use Python as a backend for my ionic app? i am new to ionic as well as backend development. If not python suggest some good language for backend development. I am working on a hybrid app. | Can I Use Python in Ionic for Backend work | 0.197375 | 0 | 0 | 12,424 |
35,841,555 | 2016-03-07T10:38:00.000 | 6 | 1 | 0 | 0 | python,ionic-framework,backend,hybrid-mobile-app | 35,842,136 | 2 | true | 0 | 0 | You can certainly work with Python. There is an awesome framework called Django which will easen up your development.
However, if you are new to backend development and are already developing the ionic app I strongly recomend using NodeJS.
It is Javascript running on the server machine. The reason is that you will be d... | 2 | 8 | 0 | Can I use Python as a backend for my ionic app? i am new to ionic as well as backend development. If not python suggest some good language for backend development. I am working on a hybrid app. | Can I Use Python in Ionic for Backend work | 1.2 | 0 | 0 | 12,424 |
35,842,899 | 2016-03-07T11:45:00.000 | 1 | 0 | 0 | 0 | python,django-models | 35,843,074 | 1 | false | 1 | 0 | Apps are logical modules. One app can contain several models. Your project could have users and blog apps. users would have User and Group models, blog would have Post, Tag and PostTag models.
Views within single app usually have same URL prefix and their own URL routing.
Within app all database migrations are execute... | 1 | 1 | 0 | I want to know if I've understand the main point of django app usage.
Every app has a models.py file which create tables in our database, correst?
For example I want to create a personal CMS. I should create an app, to create tables for my posts details, and should create an other app to creating tables for my users th... | What is django app usage? | 0.197375 | 0 | 0 | 73 |
35,844,303 | 2016-03-07T12:54:00.000 | 1 | 0 | 0 | 0 | python,mysql,django | 35,844,490 | 3 | false | 1 | 0 | The best way to do this is to store the images in your server in some specific, general folder for this images. After that you store a string in your DB with the path to the image that you want to load. This will be a more efficient way to do this. | 1 | 3 | 0 | I am trying to create my personal web page. So in that I needed to put in the recommendations panel , which contains recommendations by ex employees/friends etc.
So I was planning to create a model in django with following attributes:-
author_name
author_designation
author_image
author_comments
I have following quest... | Is it a good practice to save images in the backend database in mysql/django? | 0.066568 | 1 | 0 | 1,276 |
35,847,399 | 2016-03-07T15:20:00.000 | 4 | 0 | 0 | 0 | python,neo4j,py2neo | 35,849,399 | 2 | false | 0 | 0 | You don't. That is, I've not written a way to do that.
The watch function is intended only as a debugging utility for an interactive console session. You shouldn't need to use it in an application. | 1 | 0 | 0 | I run this earlier in the code
watch("httpstream")
Subsequently, any py2neo commands that triggers HTTP traffic will result in verbose logging. How can I stop the effect of watch() logging without creating a new Graph instance? | How do I stop py2neo watch()? | 0.379949 | 0 | 1 | 183 |
35,849,754 | 2016-03-07T17:09:00.000 | 0 | 0 | 1 | 0 | python,list,csv | 35,880,616 | 2 | false | 0 | 0 | OK, I should close this. My comment resolved the question above. I reformatted my input csv files to be values, each on a separate "line", I was able to read the lines in one by one and append them to a list. This seems really sloppy and wasteful. I was hoping for a method to read a csv file and in one line assign it ... | 1 | 0 | 1 | I know this has been asked many times, but when I try this, I always get a list of lists.
The data in my input file (col.csv) looks like:
1,2,"black", "orange"
There are NO hard returns in the data (\n)(it's a csv file, right?). When I use the csv module in python to import to a list using reader, I end up with list o... | I am trying to read several csv files in python 2.7 and assign to a list variable | 0 | 0 | 0 | 55 |
35,851,455 | 2016-03-07T18:43:00.000 | 0 | 0 | 1 | 0 | python,function,variables,closures,global | 35,851,658 | 3 | false | 0 | 0 | Global variables are discouraged because they make it hard to keep track of the state of the program. If I'm debugging a 1,000-line file, and somewhere in the middle of a function I see some_well_named_flag = False, I'm going to have a lot of hunting to do to see how else it affects what else in the program.
Functions ... | 2 | 5 | 0 | I was writing some Python code and, as usual, I try to make my functions small and give them a clear name (although sometimes a little too long). I get to the point where there are no global variables and everything a function needs is passed to it.
But I thought, in this case, every function has access to any other fu... | Why it's not ok for variables to be global but it's ok for functions? | 0 | 0 | 0 | 77 |
35,851,455 | 2016-03-07T18:43:00.000 | 7 | 0 | 1 | 0 | python,function,variables,closures,global | 35,851,566 | 3 | false | 0 | 0 | It is not a good idea to have global mutable data, e.g. variables. The mutability is the key here. You can have constants and functions to your hearts content.
But as soon as you write functions that rely on globally mutable state it limits the reusability of your functions - they're always bound to that one shared st... | 2 | 5 | 0 | I was writing some Python code and, as usual, I try to make my functions small and give them a clear name (although sometimes a little too long). I get to the point where there are no global variables and everything a function needs is passed to it.
But I thought, in this case, every function has access to any other fu... | Why it's not ok for variables to be global but it's ok for functions? | 1 | 0 | 0 | 77 |
35,851,862 | 2016-03-07T19:04:00.000 | 0 | 0 | 1 | 0 | python | 35,851,962 | 5 | false | 0 | 0 | You could use a regular expression such as "hours.*minutes", or you could use a simple string search that looks for "hours", notes the location where it is found, then does another search for "minutes" starting at that location. | 1 | 2 | 0 | I'm wondering how to detect if two substrings match a main string in a specific order. For example if we're looking for "hours" and then "minutes" anywhere at all in a string, and the string is "what is 5 hours in minutes", it would return true. If the string was "what is 5 minutes in hours", it would return false. | If multiple substrings match string in specific order | 0 | 0 | 0 | 63 |
35,858,245 | 2016-03-08T03:13:00.000 | 7 | 0 | 0 | 0 | python | 35,858,291 | 1 | true | 0 | 0 | Python dynamically sizes the string; it's not vulnerable to an overflow (though if the input is huge, it could raise a MemoryError when it can't expand the buffer further).
Python reads the input in chunks, and grows the buffer if it fills the buffer without finding a newline before reading another chunk. | 1 | 2 | 0 | Since CPython is implemented in C, when it reads a line from stdin, if the line exceeds whatever is the default size given to the string being read by the interpreter, would it cause a buffer overflow or does Python handle it? | Is Python's raw_input() vulnerable to a buffer overflow? | 1.2 | 0 | 0 | 787 |
35,858,853 | 2016-03-08T04:17:00.000 | 1 | 0 | 1 | 0 | c#,python,visual-studio | 35,859,134 | 2 | false | 0 | 0 | is there any way through which I could create a Visual Studio Project, add files to it
Whilst there is a .NET API for creating/manipulating project files, it's a bit on the undocumented side (I have used it in the past though) and I don't know if you can call it from Python. If you want to see the .NET API just look ... | 1 | 0 | 0 | I have a few questions:
Is there any way through which I could create a Visual Studio Project, add files to it, and build it from within a Python program?
Are there built-in commands to do this? If not any commands which could be run in command line?
Thanks for the help. | create a visual studio project and add files to it from a python program | 0.099668 | 0 | 0 | 1,145 |
35,859,441 | 2016-03-08T05:07:00.000 | 1 | 0 | 1 | 1 | python,linux,scripting | 35,860,000 | 3 | false | 0 | 0 | use python 3. the number of packages that don't support python 3 is shrinking every day, and the vast majority of large/important frameworks out there already support both. there are even some projects which have dropped python 2 entirely, albeit those tend not to be large (since enterprise inertia tends to hold proj... | 1 | 0 | 0 | I am a Java developer with more than 10 years of experience.
I started using python few months back when I had a requirement to create a script which pulls data from a REST service and then generates a report using this data. The fact that python is a multi purpose language (scripting, web applications, REST services ... | Choosing between Python 2(.7.x) and Python 3(.5.x) | 0.066568 | 0 | 0 | 102 |
35,866,229 | 2016-03-08T11:32:00.000 | -1 | 0 | 0 | 0 | python,svg,pygal | 36,960,515 | 5 | false | 0 | 0 | You need to include <script type="text/javascript" src="/js/pygal-tooltips.js"></script> in your html. | 3 | 3 | 0 | Following my python book, I made a bar graph using pygal. I rendered the information to an .svg file and opened it up in my web browser. My book says that the plot is interactive and will show you the value of each bar if you hover over it. However, whenever I hover my mouse over the graph, nothing happens. I am using ... | Tooltips are not working in my pygal bar graph? | -0.039979 | 0 | 0 | 1,833 |
35,866,229 | 2016-03-08T11:32:00.000 | 0 | 0 | 0 | 0 | python,svg,pygal | 66,307,881 | 5 | false | 0 | 0 | Is this issue solved?
The interaction is done using a script online with th href in the svg file.
If you don t have an internet link it will not work.
If you have solved this problem please let us know | 3 | 3 | 0 | Following my python book, I made a bar graph using pygal. I rendered the information to an .svg file and opened it up in my web browser. My book says that the plot is interactive and will show you the value of each bar if you hover over it. However, whenever I hover my mouse over the graph, nothing happens. I am using ... | Tooltips are not working in my pygal bar graph? | 0 | 0 | 0 | 1,833 |
35,866,229 | 2016-03-08T11:32:00.000 | 2 | 0 | 0 | 0 | python,svg,pygal | 36,469,495 | 5 | false | 0 | 0 | I'm having the same problem on my Windows 10 machine. Both MS Edge and Google Chrome don't render the charts as interactive.
There seems to be something happening in between the script being executed in python and the final render. The reason I note this point is because the interactive examples on the pygal site work... | 3 | 3 | 0 | Following my python book, I made a bar graph using pygal. I rendered the information to an .svg file and opened it up in my web browser. My book says that the plot is interactive and will show you the value of each bar if you hover over it. However, whenever I hover my mouse over the graph, nothing happens. I am using ... | Tooltips are not working in my pygal bar graph? | 0.07983 | 0 | 0 | 1,833 |
35,866,453 | 2016-03-08T11:44:00.000 | 1 | 0 | 0 | 0 | python,multithreading,flask | 35,866,759 | 1 | false | 1 | 0 | You can render a simple html file at your default route that make an Ajax request to a specific route which will start your script and when the script is finished return the data and catch them in your ajax request to display the data on your page. During the process of your script you can display a loader to show that... | 1 | 0 | 0 | I am writing an app using Flask that runs a shell script and displays its output in a web page. This works fine. The thing is when I run the script, it takes a long time and the page is loading during the whole time that the script is executed. What I want is that the script runs in the background and when it ends it d... | Run a script in background in flask | 0.197375 | 0 | 0 | 1,153 |
35,866,967 | 2016-03-08T12:07:00.000 | 0 | 0 | 1 | 0 | python,anaconda,vpython | 39,803,190 | 1 | false | 0 | 0 | The graph functions now live in the main vpython library when using Jupyter. So,
from vpython import *
should be sufficient. (P.S. I'd recommend not importing * but rather importing the functions you plan to use or just import vpython.)
Note however that some functions change name in the Jupyter-compatible version of... | 1 | 4 | 1 | I try to import vpython into anaconda. It seems to work so far, but if I call
from visual import * it gives me an error.
However, it does work when I type from vpython import * ,which is really weird since in all programs I only see the from visual import * command.
Now to the real problem: I can't draw graphs. I have... | Issues with importing vpython for anaconda | 0 | 0 | 0 | 3,831 |
35,869,226 | 2016-03-08T13:52:00.000 | 0 | 0 | 0 | 0 | python,rabbitmq,messages,bytestream,cloudamqp | 35,869,733 | 1 | false | 0 | 0 | The message body is a buffer, you can put what you prefer inside.
JSON, ANS1, XML or buffer audio. | 1 | 0 | 0 | How to send an audio file as message in Cloudamqp?
I'm guessing I need its byte stream and send it as a JSON. But I'm not sure if that is possible. Or do I just send the link of the location of the audio file for download? | RabbitMQ and Audiofiles | 0 | 0 | 1 | 404 |
35,869,666 | 2016-03-08T14:12:00.000 | 0 | 0 | 1 | 0 | python,logging | 35,869,928 | 1 | true | 0 | 0 | If the logger is not named, it just means it is the default logger. You can get it by calling logging.getLogger()
So to set the log level, do this:
logging.getLogger.setLevel(logging.INFO) | 1 | 1 | 0 | To change the logging level of a dependent package that properly names its logger log = logging.getLogger(__name__) is easy: logging.getLogger("name.of.package").setLevel(logging.WARNING).
But if the 3rd party package doesn't name their logger and just logs messages using logging.info("A super loud annoying message!"),... | How to change python log level for unnamed logger? | 1.2 | 0 | 0 | 133 |
35,871,850 | 2016-03-08T15:49:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,anaconda,conda | 35,872,466 | 1 | false | 0 | 0 | if you already used pip and virtual env, conda is like both at the same time. It's a package manager and also creates virtual environments.
To answer your question, conda creates a new environement, exporting python paths for this environment and installing all packages here. You can always switch between environments... | 1 | 2 | 0 | I have installed anconda with python 3.5, but i am curious to know how conda is managing between system python(2.7.6) and python3.5(installed with anaconda).
Particularly If I make a new environment with conda help containing python 3.5 and don't switch to my root env in conda while restarting the system. Does system s... | How conda manages the environment with system python and python installed with this | 0 | 0 | 0 | 642 |
35,872,623 | 2016-03-08T16:24:00.000 | 0 | 0 | 1 | 1 | python,linux,ubuntu,installation,environment-variables | 35,872,702 | 1 | false | 0 | 0 | Try installing the 2.7 version : apt-get install python2.7-dev | 1 | 0 | 0 | I have the newest version of python (2.7.11) installed on my home director. To compile the YouCompleteMe plugin, I need the python-dev to be installed. However, the global python of my environment is 2.7.11, which means that if I install python-dev via apt-get, it would incompatible with python 2.7.11, because it is us... | how to manually install the locally compiled python library (shared python library) to system? | 0 | 0 | 0 | 170 |
35,873,048 | 2016-03-08T16:43:00.000 | 1 | 0 | 0 | 0 | python,dictionary,report,execution,quickfix | 35,889,301 | 1 | false | 0 | 0 | It sounds like what you've changed in the data dictionary makes the ExecID optional rather than mandatory. If you wanted to remove "the requirement" altogether then you'd have to remove the ExecID from the fields making up an execution report in the data dictionary. However, if you did that and your cpty still sent it ... | 1 | 1 | 0 | I am connecting to an order session but I get execution reports without ExecID field. I change the requirement to no for ExecID field in ExecutionReport messages from the data dictionary but quickfix still sends reject message. Thanks for any help. | Quickfix python data dictionary | 0.197375 | 0 | 0 | 601 |
35,877,333 | 2016-03-08T20:25:00.000 | 0 | 0 | 0 | 0 | python,flask,url-routing,werkzeug | 35,878,062 | 1 | true | 1 | 0 | It turns out that 9000 was right: the '@' sign is a perfectly legal character in the URL. As such, that shouldn't be what Flask was complaining about. Much less obvious than the conversion of '@' to '%40' in the redirected URL is that the trailing slash was missing from the initial request. When writing my question, I ... | 1 | 1 | 0 | I am re-implementing a legacy system as a Flask app and must keep url patterns as they are. One of the urls includes a user's full email address directly (in other words, the email address is part of the url and not as a GET parameter).
When I send requests to this url, Flask automatically responds with a redirect to t... | Flask redirecting requests to urls containing '@' | 1.2 | 0 | 0 | 511 |
35,879,103 | 2016-03-08T22:15:00.000 | 1 | 0 | 1 | 0 | python,collections | 35,879,173 | 2 | false | 0 | 0 | You could have a data structure that maps interval start or end points to positions. In order to compute the interval you need to look up, either do some appropriate rounding on the time value in question (if the intervals can be considered regular enough for that), or use the bisect module to look up the closest start... | 1 | 0 | 0 | I've got a situation where I've got finer time granularity than I do position granularity. Let's say that I'm measuring position at 10 Hz, but am making other measurements at 100 Hz. I'm wondering if anyone is aware of a clever/efficient way of associating a position with a time interval? That is, given a time that fal... | Efficiently associating a single value with an interval | 0.099668 | 0 | 0 | 17 |
35,879,106 | 2016-03-08T22:15:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,random | 35,879,315 | 5 | false | 0 | 0 | You could declare a fixed list of approximately 1000 strings (i.e. ['000', '001', ..., '999'], omitting whatever values you like, then call random.choice() on that list.
If you don't want to type 1000 strings, you could programatically generate the list using something like range() and then .remove() your banned values... | 1 | 0 | 0 | In Python 2.7, how do I most efficiently produce a unique, random string of len=3 - formed only of digits - where values contained in a list (called exclude_me) are not considered while the random string is being calculated?
E.g. exclude_me=['312','534','434','999',...........,'123'] | Generating a random string of fixed length where certain values are prohibited | 0 | 0 | 0 | 344 |
35,880,417 | 2016-03-08T23:56:00.000 | 0 | 0 | 0 | 0 | python,video,ffmpeg,video-streaming,http-live-streaming | 35,886,856 | 2 | false | 1 | 0 | You could use FFmpeg to mux the video stream in to H.264 in a mp4 container and then that can be directly used in a HTML5 video element. | 1 | 6 | 0 | I am trying to show live webcam video stream on webpage and I have a working draft. However, I am not satisfied with the performance and looking for a better way to do the job.
I have a webcam connected to Raspberry PI and a web server which is a simple python-Flask server. Webcam images are captured by using OpenCV an... | Live Video Encoding and Streaming on a Webpage | 0 | 0 | 1 | 8,409 |
35,881,832 | 2016-03-09T02:30:00.000 | 0 | 0 | 1 | 0 | python,arrays,numpy,pandas,dataframe | 35,882,190 | 3 | false | 0 | 0 | Here's a general overview (partial credit to online documentation and Mark Lutz and Wes McKinney O'Reilly books):
list: General selection object available in Python's standard
library. Lists are positionally ordered collections of arbitrarily
typed objects, and have no fixed size. They are also mutable (str
for exampl... | 3 | 1 | 1 | I am a Python beginner and getting confused by these different forms of storing data? When should one use which. Also which of these is suitable to store a matrix (and a vector)? | Can someone consolidate the definition and the differences between a list, an array, a numpy array, a pandas dataframe , series? | 0 | 0 | 0 | 80 |
35,881,832 | 2016-03-09T02:30:00.000 | 0 | 0 | 1 | 0 | python,arrays,numpy,pandas,dataframe | 35,882,181 | 3 | false | 0 | 0 | list - the original Python way of storing multiple values
array - a little used Python module (let's ignore it)
numpy array - the closest thing in Python to the arrays, matrices and vectors used in mathematics and languages like MATLAB
dataframe, datseries - pandas structures, generally built on numpy, better suited fo... | 3 | 1 | 1 | I am a Python beginner and getting confused by these different forms of storing data? When should one use which. Also which of these is suitable to store a matrix (and a vector)? | Can someone consolidate the definition and the differences between a list, an array, a numpy array, a pandas dataframe , series? | 0 | 0 | 0 | 80 |
35,881,832 | 2016-03-09T02:30:00.000 | 0 | 0 | 1 | 0 | python,arrays,numpy,pandas,dataframe | 35,882,258 | 3 | false | 0 | 0 | Lists: lists are very flexible and can hold completely heterogeneous, arbitrary data, and they can be appended to very efficiently.
Array: The array.array type, on the other hand, is just a thin wrapper on C arrays. It can hold only homogeneous data, all of the same type, and so it uses only sizeof(one object) * lengt... | 3 | 1 | 1 | I am a Python beginner and getting confused by these different forms of storing data? When should one use which. Also which of these is suitable to store a matrix (and a vector)? | Can someone consolidate the definition and the differences between a list, an array, a numpy array, a pandas dataframe , series? | 0 | 0 | 0 | 80 |
35,881,949 | 2016-03-09T02:45:00.000 | 0 | 0 | 0 | 0 | python,tensorflow,keras | 43,664,585 | 1 | false | 0 | 0 | Keras assumes that if you are using tensorflow, you are going with (samples, channels, rows, cols) | 1 | 1 | 1 | I have a question about the 4D tensor on keras about Convolution2D Layers.
The Keras doc says:
4D tensor with shape: (samples, channels, rows, cols) if dim_ordering='th' or 4D tensor with shape: (samples, rows, cols, channels) if dim_ordering='tf'.
I use 'tf', how about my input? When I use (samples, channels, rows, co... | the input shape of array about Keras on Tensorflow | 0 | 0 | 0 | 1,225 |
35,882,062 | 2016-03-09T02:58:00.000 | 0 | 0 | 0 | 0 | python,scikit-learn | 35,889,624 | 1 | false | 0 | 0 | In the test phase you should use the same model names as you used in the trainings phase. In this way you will be able to use the model parameters which are derived in the training phase. Here is an example below;
First give a name to your vectorizer and to your predictive algoritym (It is NB in this case)
vectorize... | 1 | 0 | 1 | in text mining/classification when a vectorizer is used to transform a text into numerical features, in the training TfidfVectorizer(...).fit_transform(text) or TfidfVectorizer(...).fit(text) is used. In testing it supposes to utilize former training info and just transform the data following the training fit.
In gene... | Vectorizer where or how fit information is stored? | 0 | 0 | 0 | 172 |
35,886,892 | 2016-03-09T08:51:00.000 | 2 | 0 | 1 | 0 | python,command-line | 35,887,027 | 3 | true | 0 | 0 | if you are using windows, add the Python3 folder to the PATH variable. And then rename the python.exe to python3.exe and then you can easily use it from command line.
Also you might observe that you will be having two IDLE editors, so you can select the one which uses version you want then run code as you usually do.
I... | 3 | 0 | 0 | I started writing code in python 2, but am now doing a course that runs with python 3, so I have both installed on my Windows computer. Python 2 is my default.
Is there a way to launch python 3 from the command line if python 2 is my default?
Thanks! | Running python 3 from command line when I have python 2 & 3 both installed | 1.2 | 0 | 0 | 208 |
35,886,892 | 2016-03-09T08:51:00.000 | 0 | 0 | 1 | 0 | python,command-line | 35,887,098 | 3 | false | 0 | 0 | Try:
cd C:\Python34\
python.exe [path_to_you_script]
example:
cd C:\Python34\
python.exe "C:\Python34\000\my_script.py" | 3 | 0 | 0 | I started writing code in python 2, but am now doing a course that runs with python 3, so I have both installed on my Windows computer. Python 2 is my default.
Is there a way to launch python 3 from the command line if python 2 is my default?
Thanks! | Running python 3 from command line when I have python 2 & 3 both installed | 0 | 0 | 0 | 208 |
35,886,892 | 2016-03-09T08:51:00.000 | 1 | 0 | 1 | 0 | python,command-line | 35,886,996 | 3 | false | 0 | 0 | This may be helpful for others encountering the same problem.
You can type:
py -3
to launch python 3 if you have python 2 installed as your default. | 3 | 0 | 0 | I started writing code in python 2, but am now doing a course that runs with python 3, so I have both installed on my Windows computer. Python 2 is my default.
Is there a way to launch python 3 from the command line if python 2 is my default?
Thanks! | Running python 3 from command line when I have python 2 & 3 both installed | 0.066568 | 0 | 0 | 208 |
35,887,212 | 2016-03-09T09:09:00.000 | 1 | 0 | 0 | 0 | python,machine-learning,deep-learning | 35,887,508 | 1 | true | 0 | 0 | for deep learning to work on this you would have to develop a large dataset, most likely manually. the largest natural language processing dataset was, in fact, created manually.
BUT even if you were able to find a dataset which a model could learn off. THEN a model such as gradient boosted trees would be one, amongst ... | 1 | 0 | 1 | I have about 3,000 words and I would like to group them into about 20-50 different categories. My words are typical phrases you might find in company names. "Face", "Book", "Sales", "Force", for example.
The libraries I have been looking at so far are pandas and scikit-learn. I'm wondering if there is a machine-learnin... | Sorting words into categories in Python | 1.2 | 0 | 0 | 717 |
35,894,125 | 2016-03-09T14:19:00.000 | 3 | 0 | 0 | 1 | python | 35,894,316 | 1 | true | 0 | 0 | Instead of calling the Powershell script from inside the Python script, you should run both the scripts using the task scheduler itself.
Assuming that the command you gave to the scheduler was something like python script.py, you should change it to cmd_script.cmd where the contents of the cmd_script.cmd would be pyt... | 1 | 0 | 0 | I have two scripts one is Python based and other is powershell based.
My requirement is that I need to first run the Python script and then the powershell script on startup.
Using Task Scheduler I can run the Python script but I need to find a way to run powershell script after the python script finishes.
Some research... | How to make a Python script run a powershell script after it executes | 1.2 | 0 | 0 | 163 |
35,900,622 | 2016-03-09T19:15:00.000 | 5 | 0 | 0 | 1 | python,windows,scheduled-tasks | 35,901,175 | 2 | true | 0 | 0 | Simply save your script with .pyw extension.
As far as I know, .pyw extension is the same as .py, only difference is that .pyw was implemented for GUI programs and therefore console window is not opened.
If there is more to it than this I wouldn't know, perhaps somebody more informed can edit this post or provide their... | 1 | 3 | 0 | Windows 7 Task Scheduler is running my Python script every 15 minutes. Command line is something like c:\Python\python.exe c:\mypath\myscript.py. It all works well, script is called every 15 minues, etc.
However, the task scheduler pops up a huge console window titled taskeng.exe every time, blocking the view for a fe... | Windows Task Scheduler running Python script: how to prevent taskeng.exe pop-up? | 1.2 | 0 | 0 | 3,605 |
35,900,628 | 2016-03-09T19:16:00.000 | 0 | 1 | 0 | 1 | python,windows,python-3.x,atom-editor | 35,900,933 | 2 | true | 0 | 0 | Right click the start menu, and select System. Then, hit "Advanced system settings" > "Environment Variables". Click on path, and hit edit. Select "New" and add the folder that your python executable is in. That should fix the problem.
Your other option is to reinstall python and select "add PYTHON to PATH" as Carpets... | 2 | 0 | 0 | I am trying to run simple python code in atom using atom-runner package, but I am getting following error:
Unable to find command: python
Are you sure PATH is configured correctly?
How can I configure PATH. (path to my python is C:\Python34) | Run python3 in atom with atom-runner | 1.2 | 0 | 0 | 4,265 |
35,900,628 | 2016-03-09T19:16:00.000 | 0 | 1 | 0 | 1 | python,windows,python-3.x,atom-editor | 37,861,176 | 2 | false | 0 | 0 | If this does not work guys uninstall Python and Atom. While reinstalling Python make sure you click on "Add Python to Path" so you will not have any problems with setting the paths at all! | 2 | 0 | 0 | I am trying to run simple python code in atom using atom-runner package, but I am getting following error:
Unable to find command: python
Are you sure PATH is configured correctly?
How can I configure PATH. (path to my python is C:\Python34) | Run python3 in atom with atom-runner | 0 | 0 | 0 | 4,265 |
35,901,246 | 2016-03-09T19:48:00.000 | 2 | 0 | 0 | 0 | python,linux,opencv,terminal,raspberry-pi | 35,901,608 | 1 | false | 0 | 1 | You need to use a windowing system to display images using imshow.
(That can be enabled in settings running sudo raspi-config)
If you absolutely, positively need to display images without using a windowing system, consider providing an html/web interface. Two options that come to mind when serving a web interface are:
... | 1 | 2 | 1 | I get a gtk-WARNING when trying:
cv2.imshow("WindowName", image)
I'm using this to watch a live stream one frame at a time. Are there any alternative libraries I could use? I tried several other options like PIL and Tkinter as well as wand, but could get none of them to work for various different reason. | Show image using OpenCV in Python on a Raspberry Pi terminal | 0.379949 | 0 | 0 | 1,687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.