Time resolution here is 1 second i want to convert it to 10ms
i want to change the Time resolution in that table from 1s to be 10ms by subtraction the difference in time between each row multiply it by 100 and replicate each row with that number.
for example: Row[n] will be repeated Time((n+1)-n)*100
when Time=2 sec (third row ) we have certain values combination that will stay the same till the next Row which time =22 sec (Fourth row) so the difference in time here is = 20 sec based on this i want (third row) to be repeated (20*100)
Row[2] will be repeated (22-2)*100
import pandas
import pandas as pd
# Dataframe from Excel sheet
excel_data_Outputs_df = pandas.read_excel(".xlsx", sheet_name='Outputs')
excel_data_Inputs_df = pandas.read_excel("xlsx", sheet_name='Inputs')
# Exclude All zeros columns
excel_data_Outputs_df = excel_data_Outputs_df.loc[:, (excel_data_Outputs_df != 0).any(axis=0)]
excel_data_Inputs_df = excel_data_Inputs_df.loc[:, (excel_data_Inputs_df != 0).any(axis=0)]
# Get the time difference and convert it 10ms resolution
shifted=excel_data_Inputs_df.Time.shift(-1)
excel_data_Inputs_df.Time=(shifted-excel_data_Inputs_df.Time)*100
excel_data_Inputs_df['Time'] = excel_data_Inputs_df['Time'].fillna(0)
excel_data_Inputs_df.Time=excel_data_Inputs_df.Time.astype(int)
# Repeat Rows
newexcel_data_Inputs_df = excel_data_Inputs_df.loc[excel_data_Inputs_df.index.repeat(excel_data_Inputs_df.Time)].reset_index(drop=True)
print(newexcel_data_Inputs_df)
print(excel_data_Outputs_df)