I have tried to send a POST request to django views.py file using postman. It was working when I sent a POST and GET request to django models that haven’t ForeignKey field. However, when I tried to send a POST request to a django model that have a ForeignKey field, it wasn’t working. My question is how to send a
How to count the same rows between multiple CSV files in Pandas?
I merged 3 different CSV(D1,D2,D3) Netflow datasets and created one big dataset(df), and applied KMeans clustering to this dataset. To merge them I did not use pd.concat because of memory error and solved with Linux terminal. All these datasets contain the same column names, they have 12 columns(all numerical values) Example expected result: cluster_0 has xxxx numbers of same rows
Create Pandas DataFrame from 2 tuple lists with common first elements
I currently have 2 lists of tuples, both of which have the same information on the first element of the tuple. I’m trying to see if there is a way to “Join” these two tuple lists in a dataframe based on their common elements. Something like an SQL JOIN on a common column. Lists are something like this: and what
How can I fix the list index out of range problem?
So I wanna fill NaN value of the pay date with the date one month after the join date. Join date Payday1 Okt’10 NaN Des’10 NaN My expectation output is: Join date Payday1 Okt’10 Nov’10 Des’10 Jan’11 I try this code: This code is error in this code month=months[months.index(month)+1], it said list index out of range. So how to fix
how to limit the number of tasks run simultaneously in a specific dag on airflow?
I have a Dag in air-flow looks like that: I want to limit the tasks that running simultaneously in this dag to be 4 for example. I know there is ‘max_active_tasks_per_dag’ parameters, but it affects on all dags and in my case I want to define it only for my dag. how can I do so? it is even possible?
reassign global boolean from a function
i am trying to reassign the value of these booleans from inside of a function and use the reassigned values inside of another function. how do i do that? Answer In general, you should avoid trying to do this, as it can make your code harder to understand and debug (see action at a distance). But, if you’re really sure
Python3 interpret user input string as raw bytes (e.g. x41 == “A”)
I want to accept user input from the command line using the input() function, and I am expecting that the user provides input like x41x42x43 to input “ABC”. The user MUST enter input in the byte format, they can not provide the alphanumeric equivalent. My issue is that when I take in user input, and then print it out, I
How to convert a char array to a number for sorting?
Let’s say I have three words I want to sort: hello goodbye alex And alphabetically it’d be sorted ascendingly as [“alex”, “goodbye”, “hello”]. Is there a way to convert the string (limited to 100 characters)? For example, if I have: And I use ord to get the code for each list element: How would I create a number from that,
Dynamically changing a list while looping
I have a list: what I would like to do is loop though this list but then change the list. Basically when I loop through nums = [0, 1, 2, 3] nums would need to change to: Is there a way of changing nums like this? I feel like there is a simple solution to this, but I’ve been stumped
Transferering variable from one function to another without triggering random.choice
I’m very new to python and have gotten stuck on a problem for hours. I’m making a quiz game that picks a random word and you have to answer correctly. When I at first run the code everything i good and working correctly, but after the new_word() function is called the click() function doesn’t update so it ends up being