Category "python"

How to accept number and not prompt for another 4 digit code even if number is below 10000

This is where the Issue happens. Even if the pin is under 4 digits(10000) the second pin input will still run. print("Hello") print('Please type your username')

How to solve error with limits in boxplot (seaborn)?

The code used to plot the box plot: import seaborn as sns ax= sns.boxplot(x = "Current_Sim_Az_obj1",y= "RUT_Distance",data = df2,whis = (0,100),meanline= True,s

Python assigning the string to the variable - Str object is not callable message

I have the following problem where roles = models.StringField def role(player): if player.rank == 1: return 'leader' else: return 'memb

How to install packages offline?

What's the best way to download a python package and it's dependencies from pypi for offline installation on another machine? Is there any easy way to do this w

How to do a custom Group By?

My goal is to group a data frame DF by values of column Name and aggregate specific column as sum. Current data frame Name Val1 val2 val3 0 Test NaN 5 NaN 1 T

Efficiently and constantly reorganize searchable data based on access frequency

I want to be able to organize data for efficiency and constantly update the order of that data based on frequency of access, relevancy, and accuracy. For exampl

Refreshing data from csv in python using pandas

I'm new to python and trying to learn it on the go, i'm tring to make a data entry phonebook using python with pandas. There is the code I wrote: import pandas

Convert String to Object in Python

I want to save the string data into object. But I am getting error. Moreover, json.loads(st) not working for me. import boto3 import os import json def handler

send template data from signal in django

As soon as the django user_logged_in signal works, I want to send data to my template at that moment.I need to check if my signal is working. from django.contri

Make a list from a data frame that has repeated and non repeat values in columns

I have a data frame like this data = [['Ma', 1,'too'], ['Ma', 1,'taa'], ['Ma', 1,'tuu',],['Ga', 2,'too'], ['Ga', 2,'taa'], ['Ga', 2,'tuu',]] df = pd.DataFra

Triangle interpolation script not working

I solved a part of my question! So I removed the original question and updated it to this one: I am making a wind interpolation script. There are several weathe

Practicality of the position attribute of a Positional List Implementation in Python?

I am reading Chapter 7 of Data Structures and Algorithms in Python and I am finding the Positional List ADT quite hard to understand, the implementation given b

How to convert datetime format '%a, %d %b %Y %H:%M:%S %z' in python?

I'm trying to convert a string to datetime and keep getting the error: ValueError: time data 'Sat, 14 May 2022 12:15:00 +0000' does not match format '%a, %d %b

Loop Vectorisation

I need to vectorise the following loop using Numpy for performance purposes: for example in client_local_dataset: X.append(example['image'].numpy()) Y

The truth value of a is ambiguous when I used Iflese in Python

I am using conditional multiplication within data frame and using following syntax: if(df_merged1["region_id"]=="EMEA"): df_merged1["fcst_gr"] = df_merged1[

Requirement already satisfied but in another env - python env configuration

Even if I've enough experience with Python & VScode, I often get this major misunderstanding. For example, I have two projects Project1_folder .env1

how to pass a datetime string from strftime() as an excel sheet name using openpyxl?

The purpose of the code below is to check whether or not a sheet already exists in excel workbook. If sheet exists, then set sheet as active sheet with given na

Great expectation error when using save_expectations_config() function

I tried to run this code using PyCharm: import great_expectations as ge df=ge.read_csv(r"C:\Users\TasbeehJ\data\yellow_tripdata_2019-01.csv") print(df.expect_co

Python3 'cv2.resizeWindow('img', 500,500)' error

I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\De

How to refresh tkinter window if requirements aren't fulfilled when pushing button

So I have a make story button, but I want it to be so if the entry boxes are empty or an adjective is not selected, it refreshes the window and does not make th