Last active
September 27, 2021 07:48
-
-
Save erap129/1d25a97ab3ef1eca60ec54b58ac17e0d to your computer and use it in GitHub Desktop.
NASA RUL project - data preparation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| train_df.drop(columns=[f'sensor_{i}' for i in [3, 4, 8, 9, 13, 19, 21, 22]], inplace=True, errors='ignore') | |
| RUL = train_df.groupby('unit_number').apply(lambda group_df: | |
| pd.concat([group_df['time'].max() - group_df['time'], group_df['time']], axis=1)).\ | |
| reset_index().drop(columns=['level_1']) | |
| RUL.columns = ['unit_number', 'RUL', 'time'] | |
| train_df = pd.merge(train_df, RUL, left_on=['unit_number', 'time'], right_on=['unit_number', 'time']) | |
| X_train = train_df[[x for x in train_df.columns if 'sensor_' in x]].values | |
| y_train = train_df['RUL'].values.clip(max=125) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment