Category "python"

inputing a list of tuples into a dictionary - python programming

I'm taking a MOOC on introduction to python programming, and have no idea how to proceed with one of the problem sets on dictionaries. Could you please provide

Improperly configured error says I'll have to define env variable DJANGO_SETTINGS_Module .Please help me solving this problem [closed]

So I m just a newbie trying to learn django .. i was just trying to copy what Harry did(a youtuber who teaches code) but I got stuck right aft

How to convert YYYYMM to YYYY-MM datetime format without day?

I have two datasets that have monthly frequencies. For one of them,df, I had to aggregate some data to turn it from daily to monthly using the following code: d

Python Telegram Bot: How to measure interaction time/response time of user?

how can I measure the time the user uses to interact with the bot? E.g. The bot sends a message. We want to measure the time from the reception of the message t

Updating Spyder in Anaconda to 5.2.2

I feel like I'm going absolutely insane as I can't find any information on this anywhere... Is there anyway to update Spyder in Anaconda Navigator to version 5.

differenc between using panda.drop_duplicate or value_count on whole frame or one column

I am a new python user just for finish the homework. But I am willing to dig deeper when I meet questions. Ok the problem is from professor's sample code for d

How to return a custom Response when a Header is absent from the Request using FastAPI

I want to make an HTTP endpoint in FastAPI that requires a specific header, produces a custom response code when the header is absent, as well as shows the head

How do I delete the keyboard.on_press listener in Python?

If I have a code like this: import keyboard press = keyboard.on_press(lambda key : SOMETHING) Is there something like press.close() that I can do to delete th

How to calculate the session change of daily bars

I have a DF that looks like: date volume open close high low previous close 2022-05-02 1756159.0 118.38 119.57 120.34 116.49 2022-05-03 3217838.0 119.72 122.4

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