max

Groupby with forward looking rolling maximum

Groupby with forward looking rolling maximum Question: I have data with date, time, and values and want to calculate a forward looking rolling maximum for each date: Date Time Value Output 01/01/2022 01:00 1.3 1.4 01/01/2022 02:00 1.4 1.2 01/01/2022 03:00 0.9 1.2 01/01/2022 04:00 1.2 NaN 01/02/2022 01:00 5 4 01/02/2022 02:00 4 3 …

Total answers: 1

How do I find the max value in only specific columns in a row?

How do I find the max value in only specific columns in a row? Question: If this was my dataframe a b c 12 5 0.1 9 7 8 1.1 2 12.9 I can use the following code to get the max values in each row… (12) (9) (12.9) df = df.max(axis=1) But I don’t …

Total answers: 1

Retrieve from dict based on list values

Retrieve from dict based on list values Question: Here is my data – inp = [{‘father_husband_mother_name’: [[‘Father s Name’, 0.8603670001029968], [‘Shripati’, 0.8603670001029968], [‘Father s Name’, 0.8903670001029969], [‘Shpppati’, 0.8903670001029969]], ‘doc_id’: [[‘GGX2176’, 0.8435981869697571], [‘GGC2176’, 0.8835981869697571]], ‘name’: [[‘Elector s Name’, 0.8301510810852051], [‘Shibshankar Ghosh’, 0.8301510810852051], [‘Elector s Name’, 0.8501510810852051], [‘Shibshankar Ghosh’, 0.8501510810852051]], ‘date_of_birth’: [[‘Age as on 1.1.2000′, 0.8067844915390014], [’15’, …

Total answers: 1

get max value after grouping two columns pandas

get max value after grouping two columns pandas Question: I want to get the trip_time with the highest count for each age_group age_group trip_time counts 18 – 30yrs 01am 23 18 – 30yrs 02am 2 18 – 30yrs 03am 213 31 – 50yrs 01am 74 31 – 50yrs 02am 211 31 – 50yrs 03am 852 …

Total answers: 2

Is there a way to specify min and max values for integer column in slqalchemy?

Is there a way to specify min and max values for integer column in slqalchemy? Question: class User(Base): __tablename__ = ‘users’ id = Column(Integer, primary_key=True) age = Column(Integer)# i need age to have mix value of 0 and max of 100 email = Column(String) sqlalchemy documentation says that there no such atributes to pass while …

Total answers: 2

Python Pandas: Using groupby for to track POI's

Python Pandas: Using groupby for to track POI's Question: Im looking to mark key points in cycles based on certain conditions. Here is the result I am looking for: import pandas as pd import numpy as np Data3 = {‘Cycle’: [‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘2’,’2′, ‘2’, ‘2’, ‘2’, ‘2’], ‘Value’: [20, 24, 25, …

Total answers: 2

Python Pandas: Going through a list of cycles and making point of interest

Python Pandas: Going through a list of cycles and making point of interest Question: To explain my problem easier I have created a dataset: data = {‘Cycle’: [‘Set1’, ‘Set1’, ‘Set1’, ‘Set2’, ‘Set2’, ‘Set2’, ‘Set2’], ‘Value’: [1, 2.2, .5, .2,1,2.5,1]} I want to create a loop that goes through the "Cycle" column and marks the max …

Total answers: 1

Find index of max() after groupby

Find index of max() after groupby Question: Is there a possibility to find the index after a groupby. so in other words i use a groupby function to find max values, but i would like to find the corresponding index in the original data set and add this to a seperate column. data= pd.DataFrame( [[pd.Timestamp(‘2022-08-05 …

Total answers: 2