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
48,237,510
2018-01-13T06:37:00.000
0
0
0
0
java,android,python
48,238,627
1
false
1
0
If you have access to python from java android app. You can write python output in file, then in java code read that file. Or if python output is in web, you will need some web service that provides json/xml output, and then in java code you should call that web service.
1
0
0
I have to develop an Android application which makes use of machine learning algorithms at the back end. Now, for developing the Android app, I use Java and for implementing the machine learning algorithms I use Python. My question is how to link the Python code to an Android app written in Java. That is supposed my Py...
How to link python code to android application developed in java?
0
0
0
347
48,241,482
2018-01-13T15:50:00.000
2
0
1
0
python,shortest-path
48,241,513
3
false
0
0
How about doing list('0123456789abcdef') to make it explicit? If you don't want to spell it out, [f'{i:x}' for i in range(16)] should also work.
1
4
0
I write a python script, which needs a list of all hexadecimal characters. Is it a good idea to do list(string.printable[:16]) to get ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] ?
char list from 0 to f
0.132549
0
0
284
48,241,838
2018-01-13T16:28:00.000
0
1
0
0
python,amazon-web-services,amazon-s3,aws-lambda
50,647,228
2
false
1
0
There are certain limitations when using AWS lambda. 1) The total size of your uncompressed code and dependencies should be less than 250MB. 2) The size of your zipped code and dependencies should be less than 75MB. 3) The total fixed size of all function packages in a region should not exceed 75GB. If you are exceedin...
1
1
0
I am doing an example of a Simple Linear Regression in Python and I want to make use of Lambda functions to make it work on AWS so that I could interface it with Alexa. The problem is my Python package is 114 MB. I have tried to separate the package and the code so that I have two lambda functions but to no avail. I ha...
Working around AWS Lambda space limitations
0
0
0
946
48,241,888
2018-01-13T16:32:00.000
1
0
1
0
python,django,pip,requirements.txt
48,242,094
1
true
1
0
Sounds like you are working in a virtual environment, yet your Django dependency is installed globally. Check which Python packages are installed globally and uninstall Django (you probably don't need it globally). Then install it into your virtual environment. Now the freeze command should output Django as well. Gener...
1
1
0
I'm trying to deploy my Django site on Heroku, and thus, I need a requirements.txt file with the necessary packages that Heroku needs to install for me. I understand Django is a necessary package to be installed. Unfortunately, Django isn't included in the file when I run pip freeze > requirements.txt. Why is this? I'm...
why doesn't pip freeze > requirements.txt output Django?
1.2
0
0
1,475
48,242,064
2018-01-13T16:49:00.000
0
0
0
0
python,c,arrays,data-files
48,242,730
1
false
0
0
I'd say write it to a text file. Per line put one first column number, followed by the second column's list of floats. Put a space between each element. Assuming you know the maximum number of floats in the second column's array, and the maximum character length of each float, you can use fgets() to read the file line ...
1
1
1
I have two column dataset where each element of first column corresponds to an array. So basically my second column elements are arrays and first column elements are just numbers. I need to write it in a file using Python and later read it in C. I know HDF5 is the best way to store arrays but I was wondering if there i...
How to write arrays as column elements in a Data file in python and read it later in C?
0
0
0
135
48,243,418
2018-01-13T19:16:00.000
1
0
1
0
python,multithreading,parallel-processing,gil
48,243,488
1
true
0
0
Not quite. The GIL will prevent computationally expensive threads from executing at the same time, and won't give that much of a performance boost. On the other hand, non-computational tasks (file I/O, for example) can be multithreaded to vastly increase performance. Imagine you have to write 40 files. If the computer...
1
1
0
As the title says, since in Python we have the GIL, which says that only one thread may execute code at any one time, that means that separate threads don't really run in parallel, but rather "interlaced" but still using only a single core of the CPU. Doesn't that basically defeat the whole concept of threading? Since ...
Do threads really matter in python?
1.2
0
0
53
48,248,816
2018-01-14T10:51:00.000
0
0
1
0
python,tensorflow,pycharm
48,272,401
1
false
0
0
I found creating a project and adding the source file makes pychamr remember the project as working previous project in the list.
1
0
0
I recently installed TensorFlow on a Ubunu 14.04 machine using virtual environment and installed PyCharm to analyze TensoFlow Python programs. I downloaded mnist_softmax.py, the first tutorial program under ~/TF. I opened it with PyCharm and set the Python interpreter to the one in the virtual environment. I can run i...
how to create and save a pycharm project from an existing python program?
0
0
0
428
48,251,568
2018-01-14T16:16:00.000
0
0
0
0
python,ubuntu,tensorflow
48,259,989
1
false
0
0
You could copy the contents of your python site-packages across. But if you are generally in the situation where internet access is expensive, you might find it more practical to use a caching proxy for all of your internet traffic.
1
0
1
So I have computers all running on ubuntu and only one of them has python tensorflow module. I want to install tensorflow to all of them but it would be inefficient to connect every computer to the internet and install them all over again.so is there a possible efficient way to just copy paste some files from the compu...
how could I copy tensorflow module from one computer to another?
0
0
0
160
48,253,333
2018-01-14T19:26:00.000
0
0
1
1
python-3.x,facebook,cmd,windows-10
56,398,684
1
false
0
0
I just face this same issue. I solved by installing facebook-sdk instead just facebook. Run :-  pip install facebook-sdk or  pip3 install facebook-sdk
1
0
0
When I type pip3 install --user Facebook in my CMD. Output appear as below Could not find a version that satisfies the requirement facebook (from versions: ) No matching distribution found for facebook
Fail to install package Facebook in CMD
0
0
0
911
48,255,732
2018-01-15T00:59:00.000
3
1
0
0
python,python-3.x,discord,discord.py
48,287,783
3
false
0
0
You can iterate through every message and do: if not message.attachments: ... message.attachments returns a list and you can check if it is empty using if not
1
5
0
On my Discord server, I have a #selfies channel where people share photos and chat about them. Every now and then, I would like to somehow prune all messages that do not contain files/images. I have tried checking the documentation, but I could see not see any way of doing this. Is it not possible?
Is there a way to check if message.content on Discord contains a file?
0.197375
0
1
10,898
48,257,994
2018-01-15T06:34:00.000
2
0
0
0
python,python-2.7,download,urllib,urlretrieve
48,258,054
2
true
0
0
I think curl and head would work better than a Python solution here: curl https://my.website.com/file.txt | head -c 512 > header.txt EDIT: Also, if you absolutely must have it in a Python script, you can use subprocess to perform the curl piped to head command execution EDIT 2: For a fully Python solution: The urlopen ...
1
6
0
Situation: The file to be downloaded is a large file (>100MB). It takes quite some time, especially with slow internet connection. Problem: However, I just need the file header (the first 512 bytes), which will decide if the whole file needs to be downloaded or not. Question: Is there a way to do download only the firs...
How to Download only the first x bytes of data Python
1.2
0
1
1,451
48,263,901
2018-01-15T13:24:00.000
1
0
0
1
python,apache-kafka,kafka-producer-api
48,264,104
1
true
0
0
kafka-python does not support the Kafka Admin APIs at the moment. The only way to create topics via this client is to rely on the auto-create broker feature. However, as you've noticed, this does not allow you to provide any topic configurations. You can either: Set the replication factor in the broker config (that wi...
1
0
0
As a fact when creating a topic in kafka it is possible to set the replication factor however I was using a KafkaProducer (the kafka api for python pip install kafka) I thought I could do producer.send(...,replication-factor=3)but then there was no option for me to do that. Now I have only one option left is to direct...
Python KafkaProducer cannot set replication factor
1.2
0
0
907
48,264,656
2018-01-15T14:07:00.000
5
0
0
0
python,amazon-web-services,amazon-s3,machine-learning,amazon-sagemaker
48,278,872
8
false
1
0
Do make sure the Amazon SageMaker role has policy attached to it to have access to S3. It can be done in IAM.
1
53
1
I've just started to experiment with AWS SageMaker and would like to load data from an S3 bucket into a pandas dataframe in my SageMaker python jupyter notebook for analysis. I could use boto to grab the data from S3, but I'm wondering whether there is a more elegant method as part of the SageMaker framework to do this...
Load S3 Data into AWS SageMaker Notebook
0.124353
1
0
73,507
48,264,698
2018-01-15T14:09:00.000
4
0
1
0
python,c
48,264,739
2
false
0
1
Named arguments are not supported in C. All arguments must be passed in the correct order.
1
4
0
Is there a way to use named arguments in C function? Something like function with prototype void foo(int a, int b, int c); and I want to call it with foo(a=2, c=3, b=1); [replaced the order of b & c and used their names to distinguish] Motivation: I want a more Pythonic C, where I can easily manipulate my function argu...
A way to emulate named arguments in C
0.379949
0
0
339
48,265,821
2018-01-15T15:18:00.000
0
1
0
0
python,c,popen
48,266,333
1
false
0
0
Probably not a full answer, but I expect it gives some hints and it is far too long for a comment. You should think twice about your requirements, because it will probably not be that easy depending on your proficiency in C and what OS you are using. If I have correctly understood, you have a sensor that sends data (w...
1
0
0
I have a flow sensor that I have to read with c because python isn't fast enough but the rest of my code is python. What I want to do is have the c code running in the background and just have the python request a value from it every now and then. I know that popen is probably the easiest way to do this but I don't ful...
How to read a sensor in c but then use that input in python
0
0
0
215
48,265,893
2018-01-15T15:23:00.000
1
0
0
0
java,python
48,266,588
2
false
1
0
Normally Python and Java have their own interpreters/VM's and cannot be shared. It is possible to use Jython but has limitations (fe. python version and support/compatibility with other python packages). The interpreter and JVM do not match: Java has strict typing, python not. Java compiles and run, python is an interp...
1
1
0
Can Python invoke the Java Framework? I want to know whether a Python project can invoke a Java Framework, I find a Java Framework in GitHub, whether I can use it in my Python project?
Can Python invoke the Java Framework?
0.099668
0
0
523
48,265,926
2018-01-15T15:25:00.000
44
0
0
0
python,machine-learning,keras,deep-learning,keras-layer
48,267,194
2
true
0
0
model.layers will give you the list of all layers. The number is consequently len(model.layers)
1
24
1
Is there a way to get the number of layers (not parameters) in a Keras model? model.summary() is very informative, but it is not straightforward to get the number of layers from it.
Keras: find out the number of layers
1.2
0
0
16,915
48,267,934
2018-01-15T17:25:00.000
4
0
1
0
python,python-3.x
48,268,062
1
true
0
0
Go into the Python 3.6.4 folder, search for IDLE, then a folder called idlelib will appear. Go into that and there is a file called idle.bat; this is it.
1
1
0
I just installed the newest version of python (3.6.4) and I just had it upgrade from python 3.6.2 but now I can't find IDLE. Please help I really need to get my work done.
Windows Python 3.6.4: Can't find IDLE
1.2
0
0
7,598
48,269,197
2018-01-15T19:00:00.000
2
0
1
0
python-2.7,io,xlsxwriter
64,650,126
2
false
0
0
I was able to get around the problem by invoking the workbook.save() inside the loop. I have this long running program that keeps appending lines to the excel file and once the save method is invoked inside the loop, I can see new lines getting added as the program progresses.
2
2
0
So I am writing a program which writes data into an opened excel file. The issue is that I need to run an infinite loop and the program is closed when it is killed. The file isn't even created when I do this. workbook.close() is outside the infinite while loop. Is there a flush method within xlsxwriter so that I can...
Is there a flush method in the xlsxwriter module? [Python 2.7]
0.197375
1
0
962
48,269,197
2018-01-15T19:00:00.000
0
0
1
0
python-2.7,io,xlsxwriter
64,651,008
2
false
0
0
Is there a flush method in the xlsxwriter module No. You can only close()/save a file once with XlsxWriter.
2
2
0
So I am writing a program which writes data into an opened excel file. The issue is that I need to run an infinite loop and the program is closed when it is killed. The file isn't even created when I do this. workbook.close() is outside the infinite while loop. Is there a flush method within xlsxwriter so that I can...
Is there a flush method in the xlsxwriter module? [Python 2.7]
0
1
0
962
48,269,248
2018-01-15T19:06:00.000
0
0
1
0
python,scikit-learn,python-multithreading,xgboost
64,898,707
4
false
0
0
Currently n_jobs can be used to limit threads at predict time: model._Booster.set_param('n_jobs', 2) More info Formerly (but now deprecated): model._Booster.set_param('nthread', 2)
2
4
0
I want to use XGBoost for online production purposes (Python 2.7 XGBoost API). In order to be able to do that I want to control and limit the number of threads used by XGBoost at the predict operation. I'm using the sklearn compatible regressor offered by XGBoost (xgboost.XGBRegressor), and been trying to use the param...
Limiting the number of threads used by XGBoost
0
0
0
3,117
48,269,248
2018-01-15T19:06:00.000
1
0
1
0
python,scikit-learn,python-multithreading,xgboost
48,275,081
4
false
0
0
Answer: Standard set_params with nthread fails, but when using regr._Booster.set_param('nthread', 1) I was able to limit XGBoost to using a single thread. As mentioned above the env variable OMP_NUM_THREADS=1 works as well.
2
4
0
I want to use XGBoost for online production purposes (Python 2.7 XGBoost API). In order to be able to do that I want to control and limit the number of threads used by XGBoost at the predict operation. I'm using the sklearn compatible regressor offered by XGBoost (xgboost.XGBRegressor), and been trying to use the param...
Limiting the number of threads used by XGBoost
0.049958
0
0
3,117
48,272,093
2018-01-15T23:26:00.000
1
0
0
0
python,amazon-redshift,etl,emr,amazon-emr
48,276,498
1
false
0
0
I suppose your additional columns are measures, not dimensions. So you can keep the dimensions in the individual columns and include them into sort key, and store measures in JSON, accessing them whenever you need. Also if you can distinguish between frequently used measures vs. occasional you can store the frequently ...
1
0
0
Scenario: I have a Source which maintains the transactions data. They have around 900 columns and based on the requirements of the new business, they add additional columns. We are a BI team and we only extract around 200 columns which are required for our reporting. But when new business is launched / new analysis is ...
ETL for a frequently changing Table structure
0.197375
1
0
131
48,272,916
2018-01-16T01:30:00.000
-1
0
0
0
python,oauth-2.0,uber-api
48,273,068
2
true
1
0
The Uber Api does not support oauth2 with a username and password (at least not from python)
1
0
0
I am creating an app which only needs to access the Uber API with one account, mine. Is it possible to connect to the API with my account credentials? And if not, how else can I programmatically order rides through my account?
How to get oauth2 authorization with developer password for Uber API?
1.2
0
1
219
48,273,001
2018-01-16T01:45:00.000
0
0
0
1
python,parallel-processing,fabric
48,341,150
1
true
0
0
The task1 did not run at all because running a command with & in Fabric does not work. It is because, in linux when you log out of a session all the processes associated with it are terminated. So if you want to make sure a command keeps running even after you log out of the session you need to run it like this: run('n...
1
0
0
For my automation purposes, I'm using Fabric. But I could not run 2 tasks at the same time? For example, I want to run task 1 to collect data in the tmp folder. I want to run task 2 which will generate data and put in tmp. Tas1 2 will be running a bit before task 2. Here is my sudo code: output1 = run("./task1_data_log...
Running 2 tasks at the same time using Fabric
1.2
0
0
114
48,273,710
2018-01-16T03:33:00.000
0
0
1
0
python,compare,difflib
48,273,885
2
false
0
0
You may use below set(str1).intersection(set(str2)) which will give you the difference of the two list.
1
0
0
I'm relatively new to python and I am using difflib to compare two files and I want to find all the lines that don't match. The first file is just one line so it is essentially comparing against all the lines of the second file. When using difflib, the results show the '-' sign in front of the lines that don't match an...
difflib and removing lines even without + in front of them python
0
0
0
252
48,279,419
2018-01-16T10:46:00.000
1
1
1
0
python,class
48,279,639
2
false
0
0
Its not a matter of quality here, in Object-oriented-design which python supports, __init__ is way to supply data when an object is created first. In OOPS, this is called a constructor. In other words A constructor is a method which prepares a valid object. There are design patters on large projects are build that rely...
1
2
0
How does the quality of my code gets affected if I don't use __init__ method in python? A simple example would be appreciated.
What happens when your class does not explicitly define an __init__ method?
0.099668
0
0
486
48,279,902
2018-01-16T11:12:00.000
1
0
0
0
python,pandas,apriori
48,280,113
1
false
0
0
message is string type, and elif "what is" in message: seems to be correct in syntax. Have you checked whether the indentation is correct? Sometimes the bug can be a very simple thing..
1
0
1
I am performing Sequential Rule Mining using Apriori Algorithm and FPA, I have the dataset in excel as shown below, I want to know, how should I load my data into pandas dataframe what I am using is the following read_excel command, but the data contains ---> between items and lies in single column as shown below. How ...
Sequential Rule Mining using Apriori Algorithm and Pandas
0.197375
0
0
683
48,280,156
2018-01-16T11:26:00.000
1
0
1
0
python,pypy,bin
48,308,373
1
false
0
0
PyPy, like CPython, includes pip and setuptools. You should open a CMD command line windows, cd to the directory with the pypy.exe or pypy3.exe file, and execute pypy -mensurepip or pypy3 -ensurepip
1
1
0
I have just installed PyPy 3.5 (32-bit version) under Windows 10 and everything seems to be there, apart from the bin directory. That means that I don't have pip at my disposal and thus can't install additional packages. Is there a way to get it installed properly? This question refers to PyPy and not to CPython!
PyPy 3.5 (Windows) does not contain bin directory
0.197375
0
0
463
48,282,664
2018-01-16T13:43:00.000
0
0
1
0
python
48,282,772
2
false
0
0
Parentheses after a name means a function/method is called there. An object can be created by calling its constructor(__init__ function). Constructor is invoked by calling the class itself as a function Workbook() The functions or object methods are called similarly using parentheses.
1
2
0
I am just new in Python and have limited knowledge about Object Oriented Programming. Just want to ask a few things about Object, Methods and Function. I noticed that an Objects have parentheses right after its name like book = Workbook() and some have no parenthesis on it. May I know the difference between the two? S...
Purpose of parentheses right after object's and method's name
0
0
0
1,533
48,283,696
2018-01-16T14:38:00.000
3
0
0
1
python,heroku,celery
48,284,437
1
true
1
0
Quite simply: limit your concurrency (number of celery worker processes) to the number of tasks that can safely run in parallel on this server. Note that if you have different tasks having widly different resource needs (ie one task that eats a lot of ram and takes minutes to complete and a couple ones that are fast ...
1
3
0
I have an app running on Heroku and I'm using celery together with a worker dyno to process background work. I'm running tasks that are using quite a lot of memory. These tasks get started at roughly the same time, but I want only one or two tasks to be running at the same time, the others must wait in the queue. How c...
How to limit the number of tasks that runs in celery
1.2
0
0
1,789
48,287,088
2018-01-16T17:48:00.000
0
0
0
1
python,docker,bcolz
48,287,398
1
false
0
0
The setup.py compiles bcolz with different flags depending on the CPU. This means bcolz is not portable in a docker container.
1
0
0
I am running a docker container that works perfectly on multiple different hosts. However when I run on AWS cr1.8xlarge one of the packages (bcolz) fails with "invalid instruction" error. I exec into the container and run bcolz.test() which fails. But if I pip uninstall bcolz and then reinstall the same version with pi...
Package fails in docker container. Reinstall and it works. Why?
0
0
0
110
48,287,470
2018-01-16T18:16:00.000
0
0
0
0
python,html,pdf,jupyter-notebook,jupyter
48,291,383
2
false
1
0
I fixed this myself. It turns out that somewhere in the code, there was a tag. Although it did not run the entire length of the cell, the fact that the plaintext tag was there at all changed the dynamic of the cell. Next, I had strange formatting errors (Text was of different size and strangely emphasized) when using ...
1
0
0
I am just getting started with Jupyter Notebook and I'm running into an issue when exporting. In my current notebook, I alternate between code cells with code and markdown cells. (Which explain my code). In the markdown cells, sometimes I will use a little HTML to display a table or a list. I will also use the bold tag...
Exporting Jupyter Notebook as either PDF or HTML makes all HTML plaintext
0
0
0
1,850
48,287,766
2018-01-16T18:36:00.000
3
0
0
0
python,pandas,dataframe,sorting,dask
48,287,827
1
true
0
0
Yes, by calling set_index on the column that you wish to sort. On a single machine it uses your hard drive intelligently for excess space.
1
4
1
I need to sort a data table that is well over the size of the physical memory of the machine I am using. Pandas cannot handle it because it needs to read the entire data into memory. Can dask handle that? Thanks!
sort very large data with dask?
1.2
0
0
1,393
48,288,763
2018-01-16T19:47:00.000
2
0
1
0
python,regex
48,289,327
1
true
0
0
If you are ok with the following assertions: Names and surnames always begin with a capital letter For names reduced to one capital letter, this letter is always immediately followed by a dot Names can be separated with either a comma or the "and" word These names end with a final dot Then you can use this regex: ^...
1
0
1
I want to use regex to match patterns in paragraphs like the following: ©2016 Rina Foygel Barber and Emil Y. Sidky. Many optimization problems arising in high-dimensional statistics decompose naturally into a sum of several terms, where the individual terms are relatively simple but the composite objective function ca...
Python regex match human names with abbr (dots) in text
1.2
0
0
179
48,289,834
2018-01-16T21:06:00.000
0
0
0
0
python,django
48,289,880
3
true
1
0
Yes you can use admin panel for your teachers. for this Purpose you need to mark them as staff to login in admin panel and set for them permissions you want to add them.
3
1
0
I am currently trying to make a learning app. The three main users would be the Admin, Teacher and Student. Should I use the django admin panel for the teachers ? It has a lot of features and is fully customizable and I can choose what a teacher can do or not from there. Is this a correct approach ?
Should I use django admin panel for regular users?
1.2
0
0
754
48,289,834
2018-01-16T21:06:00.000
0
0
0
0
python,django
48,289,917
3
false
1
0
You should give an admin panel to all users. However, limit what certain users see. Example: Students shouldn't be able to create courses in the panel but Admins could.
3
1
0
I am currently trying to make a learning app. The three main users would be the Admin, Teacher and Student. Should I use the django admin panel for the teachers ? It has a lot of features and is fully customizable and I can choose what a teacher can do or not from there. Is this a correct approach ?
Should I use django admin panel for regular users?
0
0
0
754
48,289,834
2018-01-16T21:06:00.000
5
0
0
0
python,django
48,290,569
3
false
1
0
While you can use the admin panel for all users, I don't recommend it. Security is tight, but not very flexible. Also, dedicated pages developed for your user functions can be better suited for the job from both the design and functionality standpoints. Take the time to develop quality pages for your users. You won't...
3
1
0
I am currently trying to make a learning app. The three main users would be the Admin, Teacher and Student. Should I use the django admin panel for the teachers ? It has a lot of features and is fully customizable and I can choose what a teacher can do or not from there. Is this a correct approach ?
Should I use django admin panel for regular users?
0.321513
0
0
754
48,291,449
2018-01-16T23:29:00.000
3
0
1
0
python
48,291,494
1
false
0
0
If the function exists exclusively to serve that object type, then you should probably make it a method of the class; that requires the obj.func() syntax. If the function will also work on objects not of that one class, then you should make it a regular function, performing the generalization and discrimination with th...
1
2
0
I understand that the dot operator is accessing the method specific to an object that is an instance of the class containing that method/function. However, in which cases do you instead call the function directly on an object, in the form func(obj) as opposed to obj.func()? Can both techniques always be implemented (at...
In Python, when should an object be passed as an argument as opposed to calling the method on object with the dot operator?
0.53705
0
0
38
48,297,293
2018-01-17T09:08:00.000
0
0
1
0
python,namedtuple
48,297,465
2
true
0
0
Few problem's what I can see is You can't specify default arguments values for namedtuple classes.This makes them unwieldy when your data may have many optional properties . The attribute values of namedtuple instances are still accessible using numerical indexes and iteration .Especially in externalised API's , this...
1
1
0
During my online class one of my python tutors told me that namedtuple can cause more harm than good. I am confused why. Can someone please specify when to use namedtuple and when not to?
When should I use and when should I avoid namedtuple in Python?
1.2
0
0
1,346
48,299,705
2018-01-17T11:11:00.000
0
0
0
0
python,postgresql,vpn
48,399,241
1
false
0
0
Additional information on the topic revealed that actual issue being the local address he client is using for sending data when talking to the (database) server: Your client need to use the local VPN address assigned as source address. This is achieved by adding in a socket.bind(_source address_) call before the call t...
1
0
0
I have a project using pandas-python to access data from Postgres using SQLAlchemy createngine function. While I pass the credentials and hostname:portname it throws error and asks me to add the machine IP to pg_conf.hba file on the Postgres server. Which will be cumbersome as I don't have a static IP for my machine an...
Trying to access Postgres Data within the VPN without adding local machine ip to Postgres Server
0
1
0
451
48,302,876
2018-01-17T13:57:00.000
1
0
0
0
python,pandas
48,303,455
1
false
0
0
I think the problem is related to the fact that I was trying to assign a None to a bool Series, then it just tries to convert to a different type (why not object?) Fixed changing the dtype to object first: dataframe.foo = dataframe.foo.astype(object). Works like a charm now.
1
0
1
I'm facing a weird issue on Pandas now, not sure if a pandas pitfall or just something I'm missing... My pd.Series is just foo False False False > a.foo.dtype dtype('bool') When I use a dataframe.set_value(index, col, None), my whole Series is converted to dtype('float64') (same thing applies to a.at[index, col] = No...
dtype changes after set_value/at
0.197375
0
0
37
48,302,947
2018-01-17T14:01:00.000
0
0
0
0
python,attributes,gurobi
48,479,898
1
false
0
0
If m is the model, i create new model for presolve (mpre = m.presolve()), and then i use mpre.getAttr(GRB.Attr.NumVars), mpre.getAttr(GRB.Attr.NumConstrs) and mpre.getAttr(GRB.Attr.NumConstrs), mpre.getAttr(GRB.Attr.NumNZs).
1
0
1
I try to get number of rows, columns and nonzeros values after presolve. I know about getAttr(GRB.Attr.NumVars), getAttr(GRB.Attr.NumConstrs)...but they give the statics before presolve. Can any one help me. Thanks
Python Gurobi, report of statistics presolve
0
0
0
71
48,308,350
2018-01-17T19:12:00.000
2
0
1
0
python,windows,virtualenv
48,308,517
1
false
0
0
packages.txt exists in Python36-32\Scripts\ENV\Scripts, but you weren't in that directory when you ran the pip install command.
1
0
0
I have just activated my virtualenv in Python. I have a text file in the same path named "packages.txt". Below is the path: [![enter image description here][1]][1] But, I get the following error which is shown below. Unable to find the reason. Please guide.
Error while trying to install a text file of packages
0.379949
0
0
25
48,309,776
2018-01-17T20:50:00.000
0
1
0
0
python,selenium,automated-tests,modular
48,311,473
1
false
0
0
You don't really want your tests to be sequential. That breaks one of the core rules of unit tests where they should be able to be run in any order. You haven't posted any code so it's hard to know what to suggest but if you aren't using the page object model, I would suggest that you start. There are a lot of resource...
1
0
0
Edited Question: I guess I worded my previous question improperly, I actually want to get away from "unit tests" and create automated, modular system tests that build off of each other to test the application as whole. Many parts are dependent upon the previous pages and subsequent pages cannot be reached without firs...
Is it possible to make sequential tests in Python-Selenium tests?
0
0
1
150
48,310,756
2018-01-17T22:03:00.000
0
1
0
0
python,amazon-web-services,concurrency,queue,amazon-sqs
48,311,147
1
false
1
0
Hard to understand what exactly you're trying to accomplish, but I think you should let the user submit through the web server to a database, and then have your timed process query that database for 'valid' submissions to process every so many minutes. Timestamp, max() and a user/sessionId within SQL should be the only...
1
0
0
I have made a web form which, upon submit, starts a large process of operations that could result in a large batch of notifications being sent to a number of other users. In order to avoid an end-user mass-submitting many times during a short time span, I would like to queue up these operations in a queue (or what?) an...
Delay form submission and commit only the latest
0
0
0
35
48,314,010
2018-01-18T04:46:00.000
3
0
1
0
python,python-3.x
48,314,021
6
false
0
0
You can use pip freeze > requirements.txt to generate dependencies list, and use pip install -r requirements.txt to install all dependencies.
2
6
0
In Node.js, for a project we create a package.json file, which lists all the dependencies, so that NPM can automatically install them. Is there an equivalent way to do this with Python ?
Is there a way to automatically install required packages in Python?
0.099668
0
0
14,641
48,314,010
2018-01-18T04:46:00.000
3
0
1
0
python,python-3.x
61,704,488
6
false
0
0
The quickest and best way that I've found when delivering a program that has dependencies uses a few simple steps. Use pip install pipreqs that allows running pipreqs /--directory to your program folder--/ and produces the requirements.txt file inside your program's folder for your program that lists all package depe...
2
6
0
In Node.js, for a project we create a package.json file, which lists all the dependencies, so that NPM can automatically install them. Is there an equivalent way to do this with Python ?
Is there a way to automatically install required packages in Python?
0.099668
0
0
14,641
48,314,268
2018-01-18T05:15:00.000
1
0
0
0
python,amazon-web-services,aws-glue
48,823,484
9
false
0
0
Adding to CedricB, For development / testing purpose, its not necessary to upload the code to S3, and you can setup a zeppelin notebook locally, have an SSH connection established so you can have access to the data catalog/crawlers,etc. and also the s3 bucket where your data resides. After all the testing is complete...
4
38
0
After reading Amazon docs, my understanding is that the only way to run/test a Glue script is to deploy it to a dev endpoint and debug remotely if necessary. At the same time, if the (Python) code consists of multiple files and packages, all except the main script need to be zipped. All this gives me the feeling that G...
Can I test AWS Glue code locally?
0.022219
0
0
23,328
48,314,268
2018-01-18T05:15:00.000
8
0
0
0
python,amazon-web-services,aws-glue
54,096,194
9
false
0
0
I spoke to an AWS sales engineer and they said no, you can only test Glue code by running a Glue transform (in the cloud). He mentioned that there were testing out something called Outpost to allow on-prem operations, but that it wasn't publically available yet. So this seems like a solid "no" which is a shame because ...
4
38
0
After reading Amazon docs, my understanding is that the only way to run/test a Glue script is to deploy it to a dev endpoint and debug remotely if necessary. At the same time, if the (Python) code consists of multiple files and packages, all except the main script need to be zipped. All this gives me the feeling that G...
Can I test AWS Glue code locally?
1
0
0
23,328
48,314,268
2018-01-18T05:15:00.000
2
0
0
0
python,amazon-web-services,aws-glue
48,531,207
9
false
0
0
Not that I know of, and if you have a lot of remote assets, it will be tricky. Using Windows, I normally run a development endpoint and a local zeppelin notebook while I am authoring my job. I shut it down each day. You could use the job editor > script editor to edit, save, and run the job. Not sure of the cost d...
4
38
0
After reading Amazon docs, my understanding is that the only way to run/test a Glue script is to deploy it to a dev endpoint and debug remotely if necessary. At the same time, if the (Python) code consists of multiple files and packages, all except the main script need to be zipped. All this gives me the feeling that G...
Can I test AWS Glue code locally?
0.044415
0
0
23,328
48,314,268
2018-01-18T05:15:00.000
7
0
0
0
python,amazon-web-services,aws-glue
53,972,448
9
false
0
0
You can keep glue and pyspark code in separate files and can unit-test pyspark code locally. For zipping dependency files, we wrote shell script which zips files and upload to s3 location and then applies CF template to deploy glue job. For detecting dependencies, we created (glue job)_dependency.txt file.
4
38
0
After reading Amazon docs, my understanding is that the only way to run/test a Glue script is to deploy it to a dev endpoint and debug remotely if necessary. At the same time, if the (Python) code consists of multiple files and packages, all except the main script need to be zipped. All this gives me the feeling that G...
Can I test AWS Glue code locally?
1
0
0
23,328
48,314,549
2018-01-18T05:43:00.000
1
0
1
0
python,opencv,pycharm,interpreter
48,314,822
1
true
0
0
Go to project interpreter settings in preferences in Pycharm, and use the + sign there to add the module to your interpreter. This can happen when pip is installing to a directory that is not part of your project's python interpreter's PATH. Installing via the Pycharm preferences menu always solves for me, although th...
1
0
1
I am python newbie. I am doing 1 project testing of Keras. I already installed opencv by pip install opencv-python but i can't find opencv in interpreter of Pycharm and have an error when i import cv2. My interpreter is usr/bin/python2.7
I have trouble with Interpreter in Pycharm
1.2
0
0
335
48,315,785
2018-01-18T07:21:00.000
3
0
1
0
python,pyinstaller
53,320,412
5
false
0
0
I have been battling with this problem myself. Unfortunately, there is no feasible solution to the problem other than using the ugly console (completely agree there). The problem stems from the fact that until PyInstaller unpacks all the files into a temp dir, no scripts will be run. From my research, there is no way ...
1
13
0
I create a single file python application with Pyinstaller using --onefile parameters. Everything work as expected but the startup time is around 10 seconds on my machine. The problems is that during the file unpacking process of Pyinstaller package there are no visual feedback, so you don't know if the application is ...
Pyinstaller adding splash screen or visual feedback during file extraction
0.119427
0
0
7,827
48,322,232
2018-01-18T13:13:00.000
0
0
0
0
python-3.x,decision-tree,one-hot-encoding
48,341,100
1
false
0
0
Based on my tests, One-hot encoding results in continuous variables (amounts, in my case) having been assigned higher feature importance. Also, a single level of a categorical variable must meet a very high bar in order to be selected for splitting early in the tree building. This apparently degrades predictive perfor...
1
0
1
I need to build decision trees on categorical data. I understood that scikit-learn was only able to deal with numerical values, and the recommended approach is then to use on-hot encoding, preferrably using the Panda Dummies. So, I build a sample dataset where all attributes and labels are categorical. At this stage,...
Use of one-hot encoder to build decision trees
0
0
0
792
48,323,434
2018-01-18T14:20:00.000
2
0
1
0
javascript,python,regex,regex-negation,regex-group
48,323,646
2
false
0
0
(^|\s)(\w*(\.))+ - this may satisfy the sample text you've posted. You can find all '.' in third group UPDATE: if in your text you have words, started with any other symbol, for instance, #asd.qwe.zxc, you can improve your reg exp: (^|\s)[^@]?(\w*(\.))+
1
1
0
assuming the following sentence: this is @sys.any and. here @names hello. and good.bye how would I find all the '.' besides the ones appearing in words that start with @? disclaimer, been playing at regex101 for over 2 hours now after reading a few answers on SO and other forums.
Regex find char '.' except for words starting with @
0.197375
0
0
98
48,324,322
2018-01-18T15:04:00.000
0
0
1
0
python-3.x,opencv3.0
48,517,556
1
false
0
0
It could be an issue of having multiple python versions on your machine, you should select the python interpreter that is global to your system "that which utilises" pip in terminal.
1
0
1
I installed opencv in python3 using pip. It runs well in terminal, but when I try to run it in idle, it cannot import cv2. What could be the solution? I am using vim as my python idle.
Use opencv in python idle
0
0
0
787
48,326,786
2018-01-18T17:08:00.000
0
0
1
0
python-3.x,pycharm
48,326,851
1
false
0
0
It's telling you that you need Microsoft Visual C++ 10.0 as pandas library has dependencies that refer to that version of Microsoft Visual C++. It provides you the url to download and install it. Use it, then import pandas library.
1
0
1
the error message error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
While trying to import pandas library to pycharm there is an error message
0
0
0
244
48,330,515
2018-01-18T21:21:00.000
1
0
0
0
python,flask
48,330,614
3
false
1
0
to make an application works with public host you have to make sure enabling port forwarding in your modem device, you can etablish a cnx with the nginx server
2
0
0
So I've currently got a flask app that I'm using to run a testing app, (this works on local host) but I cant work out how to launch it so I can test the connectivity from other devices (public). can someone explain how I can go about launching it, or at least point me in the right direction to some documentation about ...
Launching a flask app/website so other networks can connect
0.066568
0
0
243
48,330,515
2018-01-18T21:21:00.000
0
0
0
0
python,flask
48,330,687
3
false
1
0
If you change the ip address of the flask server from the default 0.0.0.0 to your the ip address of your computer (eg 192.168.1.2) the other clients on your local network can connect. If you want to expose your app the whole of the internet you should get a host that (eg try heroku.com) that has a fixed ip assigned and...
2
0
0
So I've currently got a flask app that I'm using to run a testing app, (this works on local host) but I cant work out how to launch it so I can test the connectivity from other devices (public). can someone explain how I can go about launching it, or at least point me in the right direction to some documentation about ...
Launching a flask app/website so other networks can connect
0
0
0
243
48,331,004
2018-01-18T21:58:00.000
1
0
0
0
python,opencv,image-processing,feature-detection,sift
48,331,105
2
false
0
0
I would split the image into smaller windows. So long as you know the windows overlap (I assume you have an idea of the lateral shift) the match in any window will be valid. You can even use this as a check, the translation between feature points in any part of the image must be the same for the transform to be valid
2
1
1
I want to use OpenCV Python to do SIFT feature detection on remote sensing images. These images are high resolution and can be thousands of pixels wide (7000 x 6000 or bigger). I am having trouble with insufficient memory, however. As a reference point, I ran the same 7000 x 6000 image in Matlab (using VLFEAT) without ...
Errors processing large images with SIFT OpenCV
0.099668
0
0
649
48,331,004
2018-01-18T21:58:00.000
0
0
0
0
python,opencv,image-processing,feature-detection,sift
48,355,204
2
false
0
0
There are a few flavors how to process SIFT corner detection in this case: process single image per unit/time one core; multiprocess 2 or more images /unit time on single core; multiprocess 2 or more images/unit time on multiple cores. Read cores as either cpu or gpu. Threading result in serial processing instead of ...
2
1
1
I want to use OpenCV Python to do SIFT feature detection on remote sensing images. These images are high resolution and can be thousands of pixels wide (7000 x 6000 or bigger). I am having trouble with insufficient memory, however. As a reference point, I ran the same 7000 x 6000 image in Matlab (using VLFEAT) without ...
Errors processing large images with SIFT OpenCV
0
0
0
649
48,333,572
2018-01-19T03:11:00.000
3
0
0
0
python,postgresql,csv
48,336,589
1
true
0
0
inf (meaning infinity) is a correct value for floating point values (real and double precision), but not for numeric. So you will either have to use one of the former data types or fix the input data.
1
2
1
I am working on copying csv file content into postgresql database. While copying into the database, I get this error: invalid input syntax for type numeric: "inf" My question is: I think "inf" means "infinitive" value, is it right? what does "inf" correctly mean? If it is kinda error, is it possible to recover origin...
What mean "Inf" in csv?
1.2
1
0
1,132
48,333,923
2018-01-19T03:59:00.000
2
0
1
0
python,tabs,spyder,spaces,enter
48,334,011
1
true
0
0
(Spyder maintainer here) Spyder uses spaces by default. However, that can be changed to tabs by going to Preferences > Editor > Advanced settings > Indentation characters
1
1
0
I have read all about the horrendous nature of tabs instead of spaces in Python. When I press enter in Spyder, is the IDE adding a tab or 4 spaces?
Is pressing *enter* in Spyder (in Python) a tab or 4 spaces?
1.2
0
0
1,047
48,333,942
2018-01-19T04:02:00.000
0
0
1
0
python,visual-studio,compiler-errors,architecture,nuitka
49,217,467
1
false
0
0
I just ran into this problem today. I think it is because anaconda is probably compiled with a different C compiler. I just used the normal python (no anaconda) and pipenv to have environments.
1
0
0
When I was compiling my python project using Nuitka, there came an error: python36.lib(python36.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86' I am using Windows 10 64bit, Nuitka 0.5.28.1 Python3.6 64 bit, Visual Studio 2017 Community and Python 3.6.3 |Anaconda custom ...
fatal error LNK1112 when nuitka compile python
0
0
0
298
48,333,999
2018-01-19T04:10:00.000
6
1
0
1
python,python-2.7,python-os
48,334,082
3
false
0
0
I believe os.path.abspath(os.sep) is close to what you are asking for.
1
5
0
Situation: I need to find the top level [root] directory of any operating system using the most Pythonic way possible, without system calls. Problem: While I can check for the operating system using things like if "Windows" in platform.system(), I cannot be too sure if the drive letter is always C:\ or / (the latter be...
How to get the filesystem's root directory in Python?
1
0
0
5,801
48,335,000
2018-01-19T06:00:00.000
0
0
0
0
python,google-finance,google-finance-api
48,366,381
1
false
1
0
You can't request time series data for multiple stocks from that source at once. Instead, you have to put your request into a loop. Putting your request into a loop, you can request time series stock by stock.
1
0
0
I am able to get historical data on one stock per each request. But I need to get historical data for multiple stocks in a single request from Google finance using python. Any help will be highly appreciated! Thanks
Get historical data for multiple stocks in single request using python from Google finance
0
0
1
799
48,335,994
2018-01-19T07:23:00.000
0
0
0
0
python,algorithm,classification,knn,supervised-learning
48,701,185
1
true
0
0
There is no definite answer to this. The current trend is not do feature selection and let the classifier decide which features to use. Take current image datasets for example which also have 1000+ features (depending on the image resolution). They are fed to a CNN usually without any preprocessing. However, this is no...
1
0
1
My question is, Does the machine learning algorithm takes care of selecting the best features in my data ? or shall I do feature selection and scaling prior to my machine learning algorithm. I am aware of few supervised classification machine learning algorithms such as kNN, Neural Networks, Adaboast etc. But is th...
Do I have to do feature selection prior to applying my machine learning algorithm?
1.2
0
0
124
48,338,962
2018-01-19T10:29:00.000
1
0
1
0
python,postgresql,jupyter-notebook
51,459,116
1
false
0
0
conda install -c anaconda postgresql worked fine for me on Windows 10. I know postgresql isn't the same module as psycopg2, but the easy installation of postgresql would trump any advantages psycopg2 might have for me.
1
0
0
I have installed Anaconda 2.7 on my desktop and want to connect it to Postgresql server. I also installed psycopg2 through command prompt and it was successful. But when I import it using Jupyter notebook it shows me the following error. ImportError Traceback (most recent call last) in...
Unable to import psycopg2 in python using anaconda
0.197375
1
0
1,406
48,339,205
2018-01-19T10:40:00.000
5
0
0
0
python-3.x,rest,django-rest-framework
52,226,988
2
false
0
0
as of SEP18, also have a look on Quart, APIstar as of MAR19, add fastAPI, looks very promising nota: Bottle is lighter (& faster) than Flask, but with less bells & whistles Falcon is fast ! fastAPI is fast as well ! also, as Bottle/Flask are more general frameworks (they have templating features for instance, not API ...
1
10
0
I am new to Python and looking to build rest full web services using python. Due to some dependency, Could not use any other scripting language. Anyone can suggest if Python has any api-only kind of framework or if any other lightweight framework for rest APIs in Python. Thanks, Pooja
Which python framework will be suitable to rest api only
0.462117
0
1
10,417
48,340,410
2018-01-19T11:47:00.000
0
0
0
0
python,django,oracle,datetime
48,375,785
2
true
1
0
So finally setting my local machine's timezone to UTC with this timedatectl set-timezone UTC particular command worked.
1
0
0
I have django app running on ubuntu-14.04 and database is oracle. The timezones are as follow django- settings - TIME_ZONE = 'UTC' ubuntu - Asia/Kolkata oracle dbtimezone - UTC oracle sessiontimezone - Asia/Kolkata #this is via sqldeveloper While storing datetimes into db I am doing following. datetime.datetime.now(t...
Confusion about timezones oracle and django
1.2
0
0
281
48,342,270
2018-01-19T13:30:00.000
0
0
1
0
python,os.system
48,342,355
1
false
0
0
Can I suggest you to use ipython-notebook. It is very friendly and also supports the shell commands directly.
1
0
0
Python is lovely to me because of short line code. Is there any other way to clear Python shell without using: import os os.system('clear')
Is this possible to clear python shell without os.system("clear")?
0
0
0
120
48,343,024
2018-01-19T14:13:00.000
0
0
0
1
python,windows,oauth,google-bigquery
48,620,815
2
true
0
0
You can create the credentials by following this link cloud.google.com/storage/docs/authentication#service_accounts. In the python script, you can pass the json file path directly to the function you are using to read/write from/to BQ with the private_key argument. pandas_gbq.read_gbq(query, project_id= myprojectid, .....
1
1
0
Is there a way to schedule a python script loading data to Bigquery without having to copy the authentication code generated from a google account link for each run. I am currently using the windows task scheduler to achieve this.
Schedule a python script loading data to BigQuery under windows 10
1.2
1
0
853
48,344,081
2018-01-19T15:09:00.000
0
0
0
0
python,minimization,simulated-annealing
48,346,637
1
false
0
0
Gonna answer my own question here. I climbed into the actual .cpp code and found the answers. In Corana's method, you select how many total iterations N of annealing you want. Then the minimization is a nested series of loops where you vary the step sizes, number of step-size adjustments, and temperature values at user...
1
0
1
I'm using the PYGMO package to solve some nasty non-linear minimization problems, and am very interested in using their simulated_annealing algorithm, however it has a lot of hyper-parameters for which I don't really have any good intuition. These include: Ts (float) – starting temperature Tf (float) – final temperatu...
PAGMO/PYGMO: Anyone understand the options for Corana’s Simulated Annealing?
0
0
0
175
48,344,243
2018-01-19T15:18:00.000
0
0
1
1
python,pycharm
48,344,507
1
false
0
0
If you haven't looked at the Keymap reference from the Help menu, please do so first. I tried doing Option+Left/Right and I was able to navigate words in PyCharm Community Edition 2017.2.3. Also within the IDE, type Shift+CMD+A to find any action. However, in the PyCharm Terminal (View -> Tool Windows --> Terminal, Shi...
1
1
0
Most terminal emulators allow you to configure it to make Option+Left/Right Arrow jump forward or backward a word. Is it possible to do this in the PyCharm Terminal?
PyCharm Terminal: Make Option + Arrow Keys go backwards/forwards a word
0
0
0
214
48,349,091
2018-01-19T20:32:00.000
0
0
1
0
python,c,gcc
48,350,932
1
false
0
0
Well assuming you want to handle all type of projects and their dependencies (which is not easy) the best way is to have a module that generates a Makefile for the project and use it to compile and solve all dependencies
1
0
0
I'm trying to build a simple IDE that is web based in Python. For now, this IDE will support C only. I know it is possible to call the gcc with Python to compile and run a single C file. But what if I would like to compile and run multiple C files from a single project (i.e. linking .h files and .c files), is this poss...
Calling gcc to compile multiple files with Python
0
0
0
330
48,351,902
2018-01-20T01:58:00.000
0
0
1
0
python
48,351,965
3
false
0
0
For each dict item in the list you want to sort, you want to take the item's value keyed by 'info', which is a list, and sort on the second item (addressed as [1], counting from zero. So: data.sort(key=lambda item: item['info'][1])
1
1
1
data = [{'info': ('orange', 400000, 'apple'), 'photo': None}, {'info': ('grape', 485000, 'watermelon'), 'photo': None}] I want to sort data by the 2nd element (400000, 485000) in the tuple in the dictionary. How do I do this? I followed another answer and my closest attempt was data.sort(key=lambda tup: tup[1]), but t...
Python - Sort a list by a certain element in a tuple in a dictionary
0
0
0
55
48,352,221
2018-01-20T03:07:00.000
2
0
1
0
python,numpy,matplotlib,cross-platform
48,352,262
1
false
0
0
A popular convention is to list requirements in a text file (requirements.txt) and install them when deploying the project. Depending on your deployment configuration, libraries can be installed in a virtual environment (google keyword: virtualenv), or in a local user folder (pip install --user -r requirements.txt, if ...
1
0
0
I am writing a code in python that uses numpy, matplotlib etc. How to make sure that even a remote web server with python installed but no extra modules, can run the code without errors? I usually work on linux environment. Hence from source code, I can install the libraries in a prefix directory and can keep that alon...
How does python web developers in general include the required python modules?
0.379949
0
0
39
48,353,544
2018-01-20T07:00:00.000
0
0
0
0
python,python-3.x,amazon-redshift,aws-glue
54,622,059
3
false
0
0
AWS Glue should be able to process all the files in a folder irrespective of the name in a single job. If you don’t want the old file to be processed again move it using boto3 api for s3 to another location after each run.
1
1
1
Within AWS Glue how do I deal with files from S3 that will change every week. Example: Week 1: “filename01072018.csv” Week 2: “filename01142018.csv” These files are setup in the same format but I need Glue to be able to change per week to load this data into Redshift from S3. The code for Glue uses native Python as the...
Aws Glue - S3 - Native Python
0
0
0
292
48,353,603
2018-01-20T07:09:00.000
0
0
0
0
python,django,git,digital-ocean
48,354,146
2
false
1
0
No. Migrations are integral parts of your source code, they must be kept in your repo and deployed as any other part of your source. Remember that migrations are not restricted to generated schema change operations - some schema changes cannot be correctly generated by makemigrations and have to be manually coded, and ...
1
0
0
I'm going to push my offline Django project to Bitbucket, and then push that repo to my live Django server. My question is, do I exclude the contents in my migrations folders? And then perform makemigrations and migrate on my live server (Ubuntu/DigitalOcean) after the repo has been pushed to there?
Do I add the files in my migrations folder to my live Django server?
0
0
0
136
48,356,271
2018-01-20T12:42:00.000
0
0
0
0
python,sql,postgresql,insert
48,356,325
1
false
0
0
150 inserts per second can be a load on a database and can affect performance. There are pros and cons to changing the approach that you have. Here are some things to consider: Databases implement ACID, so inserts are secure. This is harder to achieve with buffering schemes. How important is up-to-date information ...
1
0
0
I have a python script which hits dozens of API endpoints every 10s to write climate data to a database. Lets say on average I insert 1,500 rows every 10 seconds, from 10 different threads. I am thinking of making a batch system whereby the insert queries aren't written to the db as they come in, but added to a waitin...
Overhead on an SQL insert significant?
0
1
0
46
48,357,141
2018-01-20T14:12:00.000
1
0
0
0
python
48,357,241
1
true
0
0
I would use the process of elimination. Start off with a set of all 4 digit numbers from 1000 to 9999. Then if you give the computer a cow, so the computer knows it is of the form _ _ 3 _. Remove all numbers that are not of that form from the set. If you give the computer a bull, say for the number 4. Remove all 4 dig...
1
0
0
So I've been making a small game in Python named Cows and Bulls. For those who don't know it's very simple. 1 player generates a number the other tries to guess. If the guess has a number on the correct position it gives you a cow. If it has a number but on the wrong position it gives you a bull, so until the cow value...
Cows and Bulls PC Guessing
1.2
0
1
593
48,357,407
2018-01-20T14:41:00.000
0
0
0
0
python,html,sql,asp.net
48,359,205
1
false
1
0
Oracle procedure PM_USER_LOGIN_SP has one or more parameters, each of them having its own data type. When calling that procedure, you must match number and data type of each of them. For example, if it expects 3 parameters, you can't pass only 2 (nor 4) of them (because of wrong number of arguments (parameters)). If pa...
1
0
0
I am working on a crawler using Python to grab some data on company internal web.but when I posted all the data,it showed PLS-00306 wrong number or type of arguments in call to PM_USER_LOGIN_SP ORA-066550:line 1, column 7 PL/SQL: Statement ignored I checked my Firefox inspector again and again, and all my request data...
Return PLS-00306 During login in with python
0
1
0
28
48,364,941
2018-01-21T08:19:00.000
0
0
0
0
python,web-scraping
48,365,456
1
false
0
0
Ok to answer your questions in order. As @GalAbra mentions above, it is dependent on the design of the tool. From the sounds of it though, if index.html forces the browser to post data to tool.py then the IP of where tool.py is located will be the one that requests the page. The ideal way would be to have a queing sy...
1
0
0
I am creating a web application which scrapes data from some other websites based on what the user searches. I am planning to host this application on hosting websites like Hostgator or Namecheap. Currently, the application contains a total of 2 pages. One is index.html and another is tool.py. index.html takes an input...
Which IP address will go to the destination website?
0
0
1
41
48,365,313
2018-01-21T09:14:00.000
-1
0
0
0
python,numpy,scipy,cluster-analysis,correlation
48,372,244
1
false
0
0
The obvious choice here is hierarchical agglomerative clustering. Beware that most tools (e.g., sklearn) expect a distance matrix. But it can be trivially implemented for a similarity matrix instead. Then you can use correlation. This is textbook stuff.
1
0
1
Say I calculated the correlations of prices of 500 stocks, and stored them in a 500x500 correlation matrix, with 1s on the diagonal. How can I cluster the correlations into smaller correlation matrices (in Python), such that the correlations of stocks in each matrix is maximized? Meaning to say, I would like to cluste...
Clustering a correlation matrix into multiple matrices of maximum correlations in Python
-0.197375
0
0
1,454
48,365,368
2018-01-21T09:21:00.000
1
0
1
0
windows,python-3.x,uninstallation
48,365,418
1
false
0
0
Open the installation file like will setup. When the installation window open, you can see "Change", "Repair" and "Remove". Select "Remove" and continue.
1
1
0
Python 3.6 (32 bit) is installed on my computer in Program file folder. And it is available as a shortcut in my start menu. But I do not see it in "Control Panel --> Program and Features". So I am unable to uninstall it. Is there any other way (like, command line) to uninstall Python? I have to uninstall the 32 bit. Th...
Unable to uninstall Python 3.6 (32 bit)
0.197375
0
0
4,128
48,366,535
2018-01-21T12:01:00.000
0
0
0
0
python,xml,odoo-10
57,324,645
4
false
1
0
On Odoo 12 it works only by setting readonly="True" (<- CamelCase). Using edit="False" nothing happens...
1
0
0
I was trying to make all fields in a form view read-only in odoov10. Is there any python method through I can get all the form view fields and change its attribute to readonly="True"?
How to make all fields readonly in form view odoo?
0
0
0
4,994
48,369,319
2018-01-21T16:56:00.000
0
0
0
0
python-2.7,tensorflow
48,369,514
1
false
0
0
This error probably occurs because you are using python 2.7. Where as tensorflow is for use with python 3.5 and python 3.6
1
0
1
I just upgraded from tf 1.1 to tf 1.4 for python 2.7 and I got the following problem: I have a graph which I am putting all its OPs in the specific device by using tf.device('device') command. But, one of the OPs is only allowed to be in CPU device, so I am using allow_soft_placement=True and it was working correctly ...
Allow soft placement in tensorflow
0
0
0
518
48,370,121
2018-01-21T18:14:00.000
2
0
0
0
python,machine-learning,artificial-intelligence,reinforcement-learning,openai-gym
48,370,179
1
false
0
0
You need to make up a reward that proxies the behavior you want - and that is actually no trivial business. If there is some numbers on a fixed part of the screen representing score, then you can use old fashioned image processing techniques to read the numbers and let those be your reward function. If there is a minim...
1
0
1
I am new to RL and the best I've done is CartPole in openAI gym. In cartPole, the API automatically provides the reward given the action taken. How am I supposed to decide the reward when all I have is pixel data and no "magic function" that could tell the reward for a certain action. Say, I want to make a self driving...
Reinforcement Learning - How to we decide the reward to the agent when the input to the game is only pixels?
0.379949
0
0
322
48,370,499
2018-01-21T18:54:00.000
0
1
0
0
python,django,django-apps
48,372,180
2
false
1
0
as a simple idea the inserting of new msg in database should be with a condition to limit their numbers (the count of the previous msg isn't > max ) another method : you will show the input of the msg jsut when (selet * form table where userid=sesion and count(usermsg)< max )
1
3
0
I have been using Django Postman for a few weeks now, and in order to limit the number of messages sent by each user, I have been wondering what would be the best way to limit the number of messages a user can send a day, a week... using Django-postman? I have been browsing dedicated documentation for weeks too in ord...
Is it possible to limit the number of messages a user can send a day with Django postman?
0
0
0
427
48,371,137
2018-01-21T20:01:00.000
1
0
0
0
android,python,pygame,mouseevent,mouse
48,371,785
1
true
0
1
As far as I know this is not possible. When handling input, mouse input and touch input are to be handled separately. So to answer the 2 questions you listed at the end: As far as I know there is no way to implement this functionality. You could use the pixel coordinates of the arrows. However you can use Rects for t...
1
1
0
I am trying to develop a game for Android using pygame. It would be a platformer. To move the main charachter, I would make the game to wait for mouse events (like pygame.MOUSEBUTTONDOWN). In order to do that on mobile, I'd like to create a graphic representation of a joypad with arrow keys to be shown on the bottom le...
pygame - link an object to mouse event
1.2
0
0
70
48,371,880
2018-01-21T21:25:00.000
1
0
0
0
java,python,macos,beautifulsoup
48,371,962
1
false
1
0
In linux you can use the sudo command to bypass any permission issues, I believe that same can be said for mac os. Just add into your terminal sudo "command" this will basically install it as "super user" hence you shouldn't have an issue reading and writing to files at certain locations.
1
0
0
I am getting the following error message when i try to install Beautifullsoup via mac terminal. [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-40423.pth' Please help.
Beautifull soup install mac error
0.197375
0
0
33
48,375,629
2018-01-22T06:15:00.000
0
0
1
0
macos,python-2.7,anaconda,virtualenv,jupyter-notebook
48,389,018
1
false
0
0
That's strange, a Jupyter notebook should be able to use all packages you see with conda list. What does conda info --envs show? You can activate a specific environment by doing source activate 'env-name' and then start a jupyter notebook from there.
1
0
0
I'm new to MacOS, and first time using Anaconda- I've installed Anaconda successfully and am able to read all the packages installed via conda list. I run python via Jupyter, but when I open Jupyter via cmd:Jupyter notebook, I'm not able to import some of the packages that conda lists as already installed. I've read th...
How to access anaconda libraries on a Jupyter notebook on MacOS?
0
0
0
764
48,379,797
2018-01-22T10:48:00.000
0
0
1
1
python-3.x,sorting,directory
48,391,262
1
false
0
0
I will answer my own question: it turns out that it was the fact that I had moved dir and its complete contents to a different place on my disk, thus giving them different addresses, that caused the different sorting.
1
0
0
I have been using os.walk() to traverse a bunch of subdirectories inside a directory dir. These subdirectories are numbered from 0001 to 0899. I assumed that os.walk(dir) traverses these subdirectories in numerical order, i.e., as they are shown in the finder (I am on Mac), and so far I have had no reason to believe th...
Strange behaviour of os.walk()
0
0
0
45
48,382,873
2018-01-22T13:36:00.000
0
0
1
0
python,algorithm,filtering,signal-processing,perceptron
48,451,376
1
true
0
0
Your explanation is correct. The X input vector is multiplied recursively by the filter coefficients. It's been some time since I wrote an adaptive filter, but if I remember correctly you're multiplying M filter coefficients by the latest M input values to get an update. So M is the order of your filter, or the num...
1
0
1
I am trying to implement an adaptive filter for noise cancellation, in particular a RLS filter to remove motion artifacts from a signal. To do this I am reading some literature, there is one thing I don't understand and every book or article I found just asumes I already now this. I have a reference signal represented ...
Adaptive Filter input vectors and iteration
1.2
0
0
345
48,384,337
2018-01-22T14:53:00.000
2
0
0
0
python,boto,boto3
48,384,477
1
false
1
0
No, as of now it's not possible. You have to specify the primary key to delete an item, although you can optionally pass ConditionExpression to prevent it from being deleted if some condition is not met. Only this much flexibility api is providing us.
1
1
0
Is it possible to delete an item from DynamoDB using the Python Boto3 library by specifying a secondary index value? I won't know the primary key in advance, so is it possible to skip the step of querying the index to retrieve the primary key, and just add a condition to the delete request that includes the secondary i...
Is it possible to delete a DynamoDB item based on secondary index with Python Boto3 lib?
0.379949
0
1
1,939
48,385,116
2018-01-22T15:34:00.000
9
0
1
0
python,tkinter
48,385,739
3
true
0
1
_tkinter is a C-based module that wraps an internal tcl/tk interpreter. When you import it, and it only, you get access to this interpreter but you do not get access to any of the python classes. You certainly can import _tkinter, but then you would have to recreate all of the python interfaces to the tcl/tk functions...
1
5
0
All tutorials simply import tkinter, I am wondering, though, why not import _tkinter? If my understanding is correct, _tkinter is the actual library in cpython and tkinter is the interface or API. I am simply trying to grasp the paradigm as I read through some of the tkinter source code. It seems there is some python b...
Import _tkinter or tkinter?
1.2
0
0
3,762
48,386,293
2018-01-22T16:37:00.000
3
0
0
0
python,arrays,algorithm
48,389,275
1
false
0
0
Here is my approach that I managed to come up with. First of all we know that the resulting array will contain N+M elements, meaning that the left part will contain (N+M)/2 elements, and the right part will contain (N+M)/2 elements as well. Let's denote the resulting array as Ans, and denote the size of one of its part...
1
1
1
I'm working on a competitive programming problem where we're trying to find the median of two sorted arrays. The optimal algorithm is to perform a binary search and identify splitting points, i and j, between the two arrays. I'm having trouble deriving the solution myself. I don't understand the initial logic. I will ...
How to find the median between two sorted arrays?
0.53705
0
0
711
48,387,330
2018-01-22T17:41:00.000
-1
1
0
0
telegram-bot,python-telegram-bot
48,407,514
3
false
0
0
No. You need to hardcode user id in your source and compare if user id in admin-ids array.
1
3
0
I have added my bot to a group chat, now for few commands I need to give access only to the group admin, so is it possible to identify if the message sender is admin of the group? I am using python-telegram-bot library
Telegram Bot: Can we identify if message is from group admin?
-0.066568
0
1
6,220
48,387,602
2018-01-22T17:59:00.000
4
0
0
0
python,tensorflow,keras
48,448,962
1
true
0
0
This is a question that's important in multi-task learning where you have multiple loss functions, a shared neural network structure in the middle, and inputs that may not all be valid for all loss functions. You can pass in a binary mask which are 1 or 0 for each of your loss functions, in the same way that you pass i...
1
0
1
I have a neural net with two loss functions, one is binary cross entropy for the 2 classes, and another is a regression. Now I want the regression loss to be evaluated only for class_2, and return 0 for class_1, because the regressed feature is meaningless for class_1. How can I implement such an algorithm in Keras? Tr...
Multi-Task Learning: Train a neural network to have different loss functions for the two classes?
1.2
0
0
2,069