Category "python-3.x"

Get the text and index of the current selected QTreeView item

I was wondering how I can return the text value, and index of a selected item in a QTreeView. I tried using: self.TreeView.selectedIndexes() but that returns

execute a Jupyter Notebook cell programmatically

Is it possible for a Jupyter Notebook cell to execute another cell programmatically? (i.e. using Python) And if so, is it possible to specify the cell number t

converting each element from string to int in nested list in python [duplicate]

I have data in python with nested lists, a part of which looks like: data = [['214', '205', '0', '14', '710', '1813494849', '0'], ['214', '204

Visual Studio Code Terminal keeps running Python script in Powershell

I recently installed both Python and Visual Studio Code. After taking an intro class I wrote a basic script and ran it in Visual Studio Code. That's when I no

Convert humanize time into UTC time using arrow python

I have time given in the following format. 'August 28, 2017 Mon 03:30 am - 04:00 am' I would like to convert it to the following utc format using arrow.

problem in connecting two device through socket programming in python

I'm trying to send a simple message from my mobile to my laptop through socket programming in python. I'm using win 10 and python 3.7.4 on my laptop. I am also

How can one function call another function in the same class? How to fix Unresolved reference error?

I want to create a class that includes two functions where one of them calls the other one, for example: class Parser: def foo(a): return a d

Slicing a dataframe using matches to build a new dataframe with Pandas?

I am trying to get my code to take in a dataframe, find all occurrences of "START:", then iterate through each occurrence to create 'slices' (Where the first ro

Cannot display emojis in Windows Powershell or WSL Linux Terminal using Python

I am trying to print emojis in both Windows Powershell and WSL Linux Terminal using Python3. I have tried using unicode, CLDR names and also installed the emoji

datetime expected float, got string

I'm trying to make a pyautogui script that adds the users input to the current time using the datetime/timedelta module. I want the pyautogui part to use typewr

datetime expected float, got string

I'm trying to make a pyautogui script that adds the users input to the current time using the datetime/timedelta module. I want the pyautogui part to use typewr

Rpy2 not finding package despite finding other packages within the same library

I'm using Rpy2 version 3.3.2 and despite being able to find other R packages such as 'spd', 'rugarch', 'Matrix', etc. I am not able to use 'rmgarch' despite all

Python 3 type hinting for decorator

Consider the following code: from typing import Callable, Any TFunc = Callable[..., Any] def get_authenticated_user(): return "John" def require_auth() ->

Python Postgres Package: psycopg2 copy_from vs copy_expert

Requirement: To load millions of rows into a table from S3 using Python and avoid memory issue I see there are two methods psycopg2's copy_from and copy_expert

Django How to Upload an Image to Form

This is my code associated with the form: # models class Date(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) place

How to parse datetime that ends with `Z`?

I have the following datetime string s: 2017-10-18T04:46:53.553472514Z I parese it like that: t = datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ') how to fix Val

Any optimize way to iterate excel and provide data into pd.read_sql() as a string one by one

#here I have to apply the loop which can provide me the queries from excel for respective reports: df1 = pd.read_sql(SQLqueryB2, con=con1) df2 = pd.rea

Delete trigger on a AWS Lambda function in python

I have a lambda function and for that lambda function my cloudwatch event is a trigger on it... at the end of the lambda function i need to delete the trigger

Upsampling using SMOTE in python

I am trying to use SMOTE in python to handle highly imbalanced data set. After splitting the data set into train and test I generate synthetic samples using SMO

Xml Processing with Python3

i'm working on XML processing program in Python3. i have an issue with output of my program. i've tried changing for loops in any possible way but the output i