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. When using a Python variant or library (i.e Jython, Pypy, Pandas, Numpy), please include it in the tags.

0
votes
0answers
6 views

Tensorflow not utilizing GPU

I am currently trying to train a chat bot, more specifically this one. But when I start to train the chat bot it utilizes 100% of my CPU and roughly 10% of my GPU. Does someone possibly have an idea ...
2
votes
0answers
9 views

How can I pass one parameters visible in URL and one more not with Django?

I want to pass 2 arguments thought url. The first one is an ID that I want to see in URL. The second is a counter but, this time, i don't want to see it in URL. This arguments come from a function "...
1
vote
0answers
9 views

pandas create multiple dataframes based on duplicate index dataframe

If I have a dataframe with duplicates in the index, how would I create a set of dataframes with no duplicates in the index? More precisely, given the dataframe: a b 1 1 6 1 2 7 2 3 8 2 4 ...
1
vote
0answers
11 views

Python pandas: Column to list using delimiter

Need to split the column into multiple columns. Works on excel using a space delimiter. 2.11 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE 0 cnvtToRINEX 2....
1
vote
0answers
14 views

Get a specific value of JSON data

I'm getting a JSON data from RESTCONF HTTPS request, using the following code. https_request ='https://' + host + '/restconf/data/' + operation headers = {'Content-type': 'application/yang-data+json'...
1
vote
0answers
6 views

Am I using dependencies compiled against system packages?

Following a recent announcement by AWS that they are updating the AWS Lambda execution environment, I'm trying to understand some terminology that they used. It appears that if I'm not using any '...
0
votes
0answers
7 views

cannot import name BigQueryCreateEmptyTableOperator

I am trying to use BigQueryCreateEmptyTableOperator operator but it gives me an import error.
0
votes
0answers
6 views

Specific heat fit using Debye+Einstein model in matplotlib

I am trying to find a fit to a specific heat data using gammaT+mDebye_model+(1-m)*Einstein model as given below. Cel+ph(T ) = γ T + [αCDebye(T ) + (1 − α)CEinstein(T )] where the Debye and Einstein ...
0
votes
0answers
8 views

WTF Form SelectField ValueError: too many values to unpack

I need help with this error, I have a series of SelectFields with multiple choices declared in the class like this one: TIP_FINANZIAMENTO = SelectField('TIP_FINANZIAMENTO' choices=[('',''),('01', '01 ...
0
votes
0answers
9 views

Moving specific files (with exceptions) from a network path

I'm trying to create a script in order to move files from a list I have. I'd like to create some conditions to that but I'm afraid that's where my Python knowledge fails me. I have a list of names (...
-4
votes
3answers
28 views

Spliting string without spaces

I am trying to find a way to split each letter in a word to a list. I have tried to do this with a for letter in message add space but this hasn't worked. message ='hello' for letter in message: ...
-1
votes
1answer
11 views

Fetching / Extract the row from excel based on matched value

Filter out the specific value from excel(anly columns), fetch the complete row and save in to another tab Used Pandas Input Item Units UnitCost Total Pencil 95 1.99 189.05 Binder 50 ...
0
votes
0answers
7 views

xarray - find elements depending on multiple conditions

I have a xarray's DataArray object named "da_kbdi" with the variable name being "KBDI_AWAP". <xarray.DataArray 'KBDI-AWAP' (time: 8784, latitude: 106, longitude: 193)> dask.array<shape=(8784,...
0
votes
0answers
9 views

Issue converting KeyPoints to and from JSON and then using FlannBasedMatcher

I'm saving my KeyPoints and Descriptors in a JSON file. Later when I retrieve them, I am trying to use them in a FlannBasedMatcher. However, I think something is going wrong in the conversion because ...
1
vote
1answer
31 views

how to parse a txt file to csv and modify formatting

Is there a way I can use python to take my animals.txt file results and convert it to csv and format it differently? Currently the animals.txt file looks like this: ID:- 512 NAME:- GOOSE PROJECT ...
1
vote
3answers
34 views

Python set difference of strings

I encountered the below peculiar behaviour when creating difference of string sets in Python: set(['a', 'b']) - set(['a']) # results in {'b'} as expected set(['a', 'b']) - set('a') # results in ...
0
votes
0answers
11 views

Import a TensorFlow checkpoint and use it for predictions with Keras

I want to use a pre-trained GoogLeNet model to predict images' classes with Keras. I have downloaded the relevant TensorFlow files: $ tree pretrained/ pretrained/ ├── cifar │   ├── checkpoint │   ├── ...
2
votes
0answers
29 views

What is the difference between yield and return? [duplicate]

I've read that yield is a generator but I can't really see what it implies since the output of the following function is exactly the same: def yieldFunction(number): for x in range(number) : ...
0
votes
0answers
14 views

How can I call a trained NN to train another NN in TensorFlow?

I have trained a NN, lets call it F. Now I want to train another NN, lets call it G, using the following loss function: ||F(G(x))-y||. I need to define a loss function to compute that norm. The ...
0
votes
0answers
6 views

use snakemake pair-end bwa alignment

I am new in using snakemake, I have a simple problem when doing mapping in snakemake. I have couples of _1.fastq.gz & _2.fastq.gz and I would like to do pair-end mapping for around 10 pairs of ...
0
votes
0answers
6 views

Python Cryptography generate a CSR with an attribute section challenge

I am trying to add a Challenge OID to the attributes section of a CSR using Python cryptography. I've looked into the documentation and so far i've just been able to add extra attributes to the ...
0
votes
1answer
16 views

Quicker way to iterate pandas dataframe and apply a conditional function

Summary I am trying to iterate over a large dataframe. Identify unique groups based on several columns, apply the mean to another column based on how many are in the group. My current approach is ...
0
votes
0answers
9 views

what is shortest way to export what's in a tree view to an excel file

I have a treeView witch has a lot of data i want to export this data to excel file. I want the simplest way to do this. I have an idea witch is to convert whats in tree view to data frame then save ...
0
votes
0answers
11 views

I getback a DateFrame object, but DateFrame can not call it columns

I use a package tushare to get china stock data. It returns DateFrame data, it includes the column 'date' and I want use 'date' as an index. When I use it in shell, it works. But when I use it in a ...
0
votes
0answers
6 views

Flask-SQLAlchemy: SQLALCHEMY_ENGINE_OPTIONS not set up correctly

I just updated my projects Flask-SQLAlchemy Version to the latest one (v2.4). As some of the SQL-Alchemy config parameters were deprecated, I now follow the documentation and added ...
0
votes
3answers
19 views

How to present an object oriented code with python jupyter note book?

I'm using Jupyter notebook and I want to present my object-oriented code with it. My problem is it doesn't recognize methods of my classes. I mean I want to explain each part of my code so I put each ...
1
vote
1answer
9 views

Second popup box appears when opening a textbox

I've got some code that opens a textbox so the user can input an EAN and then it scrapes the web. It all works fine except for some reason a mysterious second textbox opens with the original one and ...
1
vote
3answers
23 views

Array won't assign more than 8 characters in python [duplicate]

Array is acting weirdly, I have this code: a=np.array(['dfdfdfdf', 'gulf', 'egypt', 'hijazi a', 'gulf', 'egypt']) And I did this: a[0]="hello there my friend" Result was: array(['hello th', 'gulf'...
1
vote
0answers
7 views

“corrupted double-linked list” in Openpose (Python)

I've recently gotten the following error from my python code: corrupted double-linked list I call this function in openpose: def forward(self, image, display = False): """ Forward: ...
-3
votes
0answers
11 views

Have a logarithmic scale for a radar chart

I need to make a radar chart for values, but they are huge spaces between them : 'group': ['A','B','C','D'], 'var1': [2, 104, 9, 86], 'var2': [3702, 1423, 1222, 1214], 'var3': [1087923, 2745, 4231, ...
0
votes
0answers
4 views

How to use Visual Information Fidelity (VIF) quality metric to measure image quality in TensorFlow?

I am just using TensorFlow to realise image restoration. I would like to use the Visual Information Fidelity (VIF) (follow this paper: H. R. Sheikh and A. C. Bovik, "Image Information and Visual ...
-2
votes
1answer
22 views

Scraping a certain element in a table

I am trying to scrape a table from wikipedia about the average temperature highs and lows year for each city. I am unable to determine how to access the td tags from the table on the wikipedia page. ...
0
votes
0answers
10 views

Running variables

I am quite new with TensorFlow, I am trying to use variables, but I do not get what I expect When I declare a constant into tensorflow, and then I run into a session it works. but when I try to do ...
0
votes
0answers
6 views

pandas to_sql(): is the operation atomic or not

i want to periodically insert a pandas DataFrame into an existing mysql db in "append" mode like : df.to_sql(db, conn, if_exists='append'); is this operation atomic or not? if not, how can i make it ...
0
votes
1answer
11 views

How to handle reading, extracting & saving extremely large csv or excel data having an Angular client and a Django server

I've implemented a back-end functionality where one can upload a CSV or excel an file and then the server(Django API) will read and save all the data into the database but I feel like it's not the ...
-2
votes
0answers
24 views

How to get Low and High byte of a number

I have a string 'test'. I have a thermal printer and i have to create a qr code In the messages i have to put the low byte of the length of the string and the hight byte of the lenght of the string ...
0
votes
0answers
14 views

Cannot properly configure Django to run tests with nosetests

I am having problems running nosetests from the system command line. I installed django-nose and added it to settings.py: INSTALLED_APPS = [ ... 'django_nose', ] TEST_RUNNER ='django_nose....
0
votes
0answers
14 views

Why INPLACE_ADD is faster than the INPLACE_SUBTRACT in python?

It all begin with Raymond Hettinger's tweet about Alternative Increment Operator aka Space Invador Operator I wanted to check the performance of both += and -=- operators using the module timeit ...
0
votes
1answer
14 views

Is it possible to use Keras module in Pytorch script?

I'm creating a network similar to lpcnet introduced by mozilla but in PyTorch. At the one point I need the module src/mdense.py in my script but it is written with keras. Is it possible to import ...
0
votes
0answers
12 views

Odoo-bin give Unexpected token “Scaffold” in expression or statement in powershell

i just starting to learn odoo, when i read about their docs, they said there is a command called "odoo-bin" but when i run the command in powershell, it give me error At line:1 char:54 + ... python....
0
votes
0answers
9 views

Django makemessages MemoryError

I get an error while trying to run makemessages command for django translation. This is my settings.py file, with all the configuration find in the django manual. MIDDLEWARE = [ 'django.contrib....
0
votes
1answer
26 views

How to make read_csv more flexibile with numbers and whitespaces

I want to read a txt.file with Pandas and the Problem is the seperator/delimiter consits of a number and Minimum two blanks afterwards. I already tried it similiar to this code (How to make separator ...
0
votes
0answers
11 views

Parsing suds response in python

I a trying to get the value of SecretId from below suds response: (SearchSecretsResult){ Errors = "" SecretSummaries = (ArrayOfSecretSummary){ SecretSummary[] = (...
0
votes
1answer
13 views

Model delete() and deserialized_object.save() calls don't work if called consecutively

I am trying to import json to my django webapp and its almost working fine except one problem. When I delete the objects 1-2 lines before calling deserialized_object.save() it works fine but if I ...
1
vote
0answers
18 views

python asyncio: Execute async callback from synchronous code immediately

Problem I have a library which currently has no async support and needs to be called from async code. The async code calls into the library through a handler (handler function in the code below). ...
1
vote
2answers
16 views

How to display Hour, Minute values from QTimeEdit to corresponding LCD's?

I used QTimeEdit to edit time. But when I clicked "ok" the output is HOUR: 16 MINUTE: 8, no matter what number I put in QTimeEdit. Thus, I want to know what function I must add to correct the set time ...
0
votes
1answer
9 views

Checking if LinearRing contains a point always returns False in Shapely

This is variation of Shapely contains(point) always gives False, not a duplicate I want to determine if a point inside a certain figure created of many points, but to start simple I do this test, ...
0
votes
0answers
5 views

SVM - validation procedure on validation set - NOT k-fold cross validation

I'm new to python and machine learning and I'm having difficulty understanding validation step also would like to have a suggestion on what to do when I don't want to use k-folds cross-validation, but ...
0
votes
0answers
10 views

Asterisk in method definition [duplicate]

I was looking through the urllib.urlopen method and I saw this in its definition. What is meant by this? def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *, cafile=None,...
0
votes
0answers
11 views

How to recieve a buffer of ints and strings from a client , and store them right? (cpp server , python client)

I have a simple cpp server which receives a char * buffer from a python client and unpacks it in order to use the data. the python client sends a buffer which includes 2 "different" data types - ...

http://mssss.yulina-kosm.ru