Questions tagged [python]

Python is a multi-paradigm, dynamically typed, multipurpose programming language, designed to be quick (to learn, to use, and to understand), and to enforce a clean and uniform syntax. Two similar but incompatible versions of Python are commonly in use, Python 2.7 and 3.x. For version-specific Python questions, use the [python-2.7] or [python-3.x] tags, or more specific [python-3.6]. When using a Python variant (i.e Jython, Pypy, etc...), please tag it.

0
votes
0answers
4 views

Set list of index of numpy array to a specific value efficiently

The following works fine, but I want something more efficient than looping through import numpy as np x=np.random.binomial(1,1,[10,10]) keep_prob=0.5 pairs=np.argwhere(x>0) np.random.shuffle(pairs)...
0
votes
0answers
2 views

Saving images uploaded through ImageField

I am trying to set up a webapp that accepts image uploads from a user, using ImageField, but I cant seem to figure out how to save the uploaded image. My media folder is empty even though there doesnt ...
0
votes
0answers
3 views

Convert string output to verify each line

I have a string that’s returned and I want to verify that each new line is correct. I’m unsure if I want to turn it to a dictionary to verify or is there a better way? What I really want is to ...
0
votes
1answer
10 views

why do I sometimes get an Index error but sometimes not?

I got an index error but I can't figure out why. import random list1=[1,2] list2=[[1,2], [1,3], [1,4], [2,1], [2,2]] result = [] for i in list1: tmpList = [] for j in list2: if j[0]...
0
votes
0answers
5 views

Switching between kivy classes inside one screen

I'm looking for a way to change a part of a screen between 'DownPanel1' and 'DownPanel1' but I would like to avoide creating nex screen class 'ToAvoid'. Is it possible? from kivy.config import Config ...
0
votes
1answer
5 views

How to fix re.sub capturing in Python regex?

I am cleaning some data for text analysis that I extracted from PDFs. I have noticed that one of the errors is strange spacing in words that end in "y." Specifically, the final y is broken off from ...
0
votes
0answers
4 views

Add weight to the edges of a link matrix

I have a matrix that contains a set of value that should also be the value of the distance between two nodes. Currently, my code is reading from this matrix using the networkx function ...
0
votes
0answers
3 views

virtualenvwrapper: how to change mkvirtualenv's default Python version/path to install

I had this in my .bash_profile: PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" And I thought that if I just change it to this: PATH="/Users/myusername/.pyenv/versions/3.7.2/...
1
vote
0answers
6 views

Scikitlearn - Tensorflow pipeline - How to save pipeline in hd5

I have created a pipeline model mixing scikit learn preprocessing and keras. scaler = StandardScaler() estimators = [] estimators.append(('standardize',StandardScaler())) estimators.append(('mlp',...
0
votes
3answers
16 views

How do I increase the value of a variable within a loop?

I'm building this rock, paper, scissors game and I've gotten quite far. However, I can't get the final scores to print correctly. No matter the situation, I always get 0 value on total rounds, total ...
0
votes
0answers
3 views

Gensim Attribute Error when trying to use pre_scan on a doc2vec object

I am following the tutorial here: https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-wikipedia.ipynb But when I get to this part: pre = Doc2Vec(min_count=0) pre....
0
votes
0answers
6 views

Reading Multiple pdf through GUI

I am new to python and i am trying to read multiple pdf files through GUI using python 3.7,anaconda,tkinter .i am using button to read files but problem it is reading directly when i am calling that ...
0
votes
1answer
19 views

Does the accuracy of the deep learning program drop if I do not put in the default input shape into the pretrained model?

As the title says, I want to know whether input shape affects the accuracy of the deep learning model. Also, can pre-trained models (like Xception) be used on grayscale images? P.S. : I recently ...
-1
votes
2answers
11 views

I used natsort library and sorted function.. and I got a missed up result?

I need to sort images based on their numbers, but when ever it meets 1 in the first index so it's, and goes on so it might be like this: 1.jpg 10.jpg 11.jpg 2.jpg 21.jpg 3.jpg 4.jpg I tired natsort ...
2
votes
0answers
13 views

Custom Dependent Dropdown in Django

I am trying to implement two dropdowns in my registration page with custom fields that prompt a user to select their phone brand and the specific model of their phone. I want to have the phone model ...

15 30 50 per page