I’m very new to python as in I’m making this bot for fun, but I’ve been trying to make a simple discord.py bot that will respond to keywords that aren’t case sensitive as well as detect the word in a message. I’ve been able to have it be non case sensitive, but the main issue tha…
Tag: python
Create list of list tuples from reading a txt file
I have a txt file that look likes And Im trying to make a tuples from this txt which ı will evalute them laterly word to features later on. I want to have a list of list look like this : All of the whitespaces indicates that the sentences over and should add to list to given index, laterly after
Can not get cookie from localhost websocket fast api
I’m testing websockets to work with cookies and trying to get them in fast api. I manually installed them in chrome but I get an empty dictionary inside the application. I used the fast api documentation templates and slightly redesigned it My html My websocket print(websocket.cookies) returns an empty …
python) update value of array in dictionary and update it
I want to update ‘array’ inside the dictionary after doing interpolation. for example, “array_ex” is a dictionary and has values like below and ‘0_array’ has (6,100) shape while ‘1_array’ has (6,200) shape… I wrote a function for interpolating the array us…
Multiply pandas dataframe with a differently shaped dataframe based on condition
I have a pandas DataFrame (df_A) with this basic form: Furthermore I have another DataFrame (df_B): What I want to do is multiply the values of the second DataFrame with the values of the first, where the alt value is the same. I also do not want the d or e columns to be involved in the multiplication. So I
python print array inside the dictionary
I want to print ‘array’ inside the dictionary but my code gives me ‘each value’ of the array. for example, “array_ex” is a dictionary and has values like below with 12 rows for each array… and I want to get each row of the array as a result. However, my code returns e…
Get only data that are repeated any one of the given year in pandas
Below is the Raw Data. I want only those event which will repeat in given set of list of years. Eg [2012,2013]. So now it should only get data if event is repeated in one of the given year in the list. I want below output. Answer You can try groupby and filter
How can I add a colour gradient feature to my bresenham line drawing algorithm?
I’ve found this thread on StackOverflow but my python understanding isn’t that good to properly translate it to C, I’m trying to add that gradient feature to this line drawing algorithm: I feel bad for asking such a trivial task but I really can’t understand what is going on on the pyt…
How to save each line of a file to a new file (every line a new file) and do that for multiple original files
I have 5 files from which i want to take each line (24 lines in total) and save it to a new file. I managed to find a code which will do that but they way it is, every time i have to manually change the number of the appropriate original file and of the file i want to save
using pop on multidimensional lists python with dynamoDB
I want to pop an item from a list of lists. So I have a scan for all dynamo Items and want to “pop” one field from each list. For example: The List: From this example, I have a bunch of Results and for every result list, I will remove the Item “credentials” like However, this isn’…