This is such a simple question but I can't find it using the terms 'normalize' or the overused term 'index'. How do I set the start value of all my 'cars' to 100? In reality there are 52 cars and much more timestamps.
import pandas as pd
ExampleOfWhatIHave = {'Car':['A', 'B', 'A', 'B'],
'Hour':['1', '1', '2', '2'],
'Car-speed':[10, 20, 11, 19]}
ExampleOfWhatINeed = {'Car':['A', 'B', 'A', 'B'],
'Hour':['1', '1', '2', '2'],
'Car51-speed':[100, 100, 110, 95]}
# Create DataFrame
df = pd.DataFrame(ExampleOfWhatIHave)
df = pd.DataFrame(ExampleOfWhatINeed)
How about this nice one liner?
df['Car51-speed'] = 100 * df['Car-speed'] / df.groupby('Car')['Car-speed'].transform('first')