I have a particular problem, I would like to clean and prepare my data and I have a lot of unknown values for the “highpoint_metres” column of my dataframe (members). As there is no missing information for the “peak_id”, I calculated the median value of the height according to the peak…
Writing a python function for raising irrational numbers to higher powers
I want to write a function in python called compute(a,b,p,n) where a,b,n are integers and n>0 and p is prime, that outputs the tuple (x,y) (x,y being integers) such that Note that the constraints of the problem state that you’re not allowed to use any external libraries. Now, I set about to solve thi…
Summing up all repeated values in a dataset
I have a dataset in which in a column I have the name of a person and in another column I have the amount she was paid for a given service. I’d like to build a list with the names of all people ordained by the total amount they were paid regardless of the service they performed. Example: I figured
pdfplumber | Extract text from dynamic column layouts
Attempted Solution at bottom of post. I have near-working code that extracts the sentence containing a phrase, across multiple lines. However, some pages have columns. So respective outputs are incorrect; where separate texts are wrongly merged together as a bad sentence. This problem has been addressed in th…
GEKKO variable update in real time
How do I need to setup m.time and update the initial conditions if I want to use GEKKO in an online simulation that updates every second? I have tried: but it doesn’t seem to update the values. I’m using IMODE = 4 This is just a dynamic simulation application. No control at the moment. Answer Gekk…
python need to iterate a list over a list of dicts
python need to iterate a list over a list of dicts I need to iterate the list a over a list of dict b whether the value present or not. If present take some values from b and if not input as 0 for the months till september it should show as 0 and for december,jan and feb its should
Newbie – customer profiling in Python (pandas) using loc()
I’m a newbie, so please excuse me if I use incorrect terms. I have a df with customer purchasing info and customers are identified by a unique user_id. Each item a user_id buys in each transaction creates a new row (if a customer buys 5 products in 1 transaction, 5 different rows are created with that p…
Find tuple in list of tuples in python
I have a list of tuple (simulationtime,efficiency) and I want to find the tuple in which the maximum efficiency is stated with respect to the minimum simulation time. Any hints on how that could be done? A small part of the otherwise very large list: [(109.00537427472713, 0.8), (109.00588429136333, 0.85), (10…
How to find the values of a key in a nested list of dictionaries in Python
This is my data structure. I have 3000 instances of ‘product’ within the ‘clothes list’. Each contains another list of dictionaries that stores the reviews. I am attempting to iterate through all the reviews in the dictionary and return all the reviews written by a particular username.…
How do you shoot a bullet towards mouse in pygame at a constant speed?
I am trying to shoot a bullet towards my mouse in pygame, here is my code: I am confused on how to make this work, I think somehow I am rounding something, but even after I put float() in, it still is not working. Also, before when I used the mouse coordinates, it works, but when close to tank, it