Category "python"

Mimicking compile time interfaces in python

Summary This question first uses Java examples to demonstrate what I am trying to achieve, then shows Python equivalents where I attempt to replicate the compil

How do I remove hours and seconds from my DataFrame column in python? [duplicate]

I have a DataFrame : Age Gender Address Date 15 M 172 ST 2022-02-07 00:00:00 I Want to remove hh:mm:ss I tried: import datetime

How to merge different shaped netcdf4 files?

I am storing weather forecasts as netcdf4 files. These netcdf4 files are batched following the google maps tiles principle. This means I define a zoom level (he

How can I solve this loop function?

L 36 [L 4 [F 100 R 90] R 10] Explanation : This program first loop 36 times inside the closed paranthesis and inside 4 times draw F 100 and R 90 (basic square d

How to implement Modular Exponentiation Code

Please I was learning from the book Introduction to algorithm (Chapter 31 page 957) and came across this pseudocode. This pseudocode is how we can implement the

Set numbering value with python-docx

Is there a way to set the numbering value of a numbered list with python-docx inside a word document? I created a word template that has a custom style that gen

SqlModel datetime field is throwing error upon execution

I am using SQLModel in python 3.8 When I add my datetime field created_at: datetime = Field(default_factory=utcnow(), nullable=False) I get this Error File "./a

How do I implement Huffman coding followed by AES-128 for a text in Python?

After having implemented Huffman coding for text in Python, how do I effectively encrypt the resultant Huffman codes in AES-128? Huffman Coding using Python For

AttributeError: 'function' object has no attribute 'get' when testing Flask requests

Good afternoon, I am developing some unit tests for my Flask application. It is my first time trying to develop unit tests for a Flask app, but I am currently g

Python - if ... then with multiple wildcards

I use the following python snippet within my code to scan a given soup for keywords. It´s only possible that one of the word is inside the soup. Concernin

Alternative way to append a dataframe to itself N times and populate new column

Is there an alternative way to append a dataframe to itself N times where N is based on a list length, and the list contents are added as a new column to the da

QTimer format converting

I have this code: from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import Qt, QTimer import sys class Ui_Timer15(object): def setupUi(self, Ti

I can't do that loop function

Here is my project, it' s drawing robot: I manage to do F and R functions. But my L function always malfunctions. Here is my code: def func(list1): numOfElemen

How to use a CNN code in python inside a website?

I have website with backend in Python (Django) and JavaScript hosted on heroku. Also, I have code in python that does image classification with EfficientNet, so

Can I get the mouse position with a different format

I am trying to get the position of my mouse, but make it print just the coordinates like 1000, 1000 Not like Point(x=1212, y=621) My Code: x = pyautogui.posi

Understanding continuation tokens in AWS S3

I'd like to understand better how continuation tokens work in list_objects_v2(). Here is a piece of code that iterates through a large S3 bucket, storing the co

How to use dedicated GPU with TF2, given that multiple GPUs are available?

As title. I thought these lines would work to use only one GPU: _GPU = tf.config.list_physical_devices('GPU')[3] tf.config.experimental.set_memory_growth(_GPU,

Whats wrong with my RK4 Orbital Propagator?

I am working in a RK4 orbital propagator, and I have followed the basic structure of: k1​=dt×f(tn​,yn​) k2​=dt×f(tn​

How to match the input image with the ground truth image (the order)

I'm a beginner learning deep learning and trying to do semantic segmentation problems on histologic image using python and TensorFlow. There is 2 main file : Im

Implementation details of K-means++ without sklearn

I am doing K-means using MINST dataset. However, I found difficulties in the implementation on initialization and some further steps. For the initialization, I