Category "python"

Pandas groupby mean - into a dataframe?

Say my data looks like this: date,name,id,dept,sale1,sale2,sale3,total_sale 1/1/17,John,50,Sales,50.0,60.0,70.0,180.0 1/1/17,Mike,21,Engg,43.0,55.0,2.0,100.0 1

Python - find pattern in file in max 4 lines of code

i have the following task. I have to find a specific pattern(word) in my file.txt(is a song centered on page) and to print out the row number + the row which ha

Why do new variable names need to be on the left of the equals (=)?

I am curious as to why a certain format produces an error while the other doesn't. Code that works: name = input().split() if len(name) == 3: first_name, mid

Can't set default image django

I was create a profile for user. I done set up all the Media and Static. But when I set default and upload_to in image field, it error not found image. I had tr

'WordListCorpusReader' object has no attribute 'add'

enter image description here Code: import re import nltk nltk.download('stopwords') stopwords = stopwords stopwords.add('will') wordcloud = WordCloud(width = 3

Python tkinter - Display all the checkbuttons selected

I created a GUI with 2 input boxes and a list of checkbuttons (derived from list 'a') with scroll. Now, I want to display all the checkbuttons which have been s

Determine the exact error of a long python line

I have long lines in my code such as: if (currentExcelDep[excelPackageName]== depDataCollection[depDataCollectionSet][depDataCollectionSetElement][excelPath] an

Python - browser pages managment

I am using Google Chrome and I need to find a way of finding on existing window and existing page way of interaction with it ( clicking on something and all tha

Writing charcters in the csv files instead of writing the sentence

I want to save my data in the CSV format, I have some sentences and I want to save every sentence in a different row, but the output is like this: This is my c

Sequence analysis for the frames in a video

I am currently working on the sequence analysis for the frames in a video. I got the predictions from the neural network. Now, I want to find the error rate of

ModuleNotFoundError: No module named 'scikits.talkbox'

i am importing from scikits.talkbox.features import mfcc from scipy.io import wavfile but getting this error: ModuleNotFoundError: No module named 'scikits.tal

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