Jun-23-2022, 05:24 PM
I am trying to use StandardScaler on a dataset that is but not all numbers.
The way to do that is now shown.
They are shown as
My question is how to I modify the above code so it works on all columns except the first and the last. I am hoping that there could be a one line executable that can do this, not a loop. It would be very similar to the third line in the code, but with modifications.
Thanks in advance.
Respectfully,
LZ
The way to do that is now shown.
from sklearn.preprocessing import StandardScaler scaler=StandardScaler() df=scaler.fit_transform(df)However, I do not think it will work since two columns in the dataset; timestamp and machine condition are not numbers.
They are shown as
Unnamed: 0 timestamp sensor_00 sensor_01 sensor_02 sensor_03 sensor_04 sensor_05 sensor_06 sensor_07 ... sensor_43 sensor_44 machine_status 0 0 2018-04-01 00:00:00 2.465394 47.09201 53.2118 46.310760 634.3750 76.45975 13.41146 16.13136 ... 41.92708 39.641200 .... NORMAL 1 1 2018-04-01 00:01:00 2.465394 47.09201 53.2118 46.310760 634.3750 76.45975 13.41146 16.13136 ... 41.92708 39.641200 ... NORMAL 2 2 2018-04-01 00:02:00 2.444734 47.35243 53.2118 46.397570 638.8889 73.54598 13.32465 16.03733 ... 41.66666 39.351852 ... NORMAL 3 3 2018-04-01 00:03:00 2.460474 47.09201 53.1684 46.397568 628.1250 76.98898 13.31742 16.24711 ... 40.88541 39.062500 ... NORMAL 4 4 2018-04-01 00:04:00 2.445718 47.13541 53.2118 46.397568 636.4583 76.58897 13.35359 16.21094 ... 41.40625 38.773150 ... NORMALNow as I said the first and last columns are timestamp and machine status, respectively. They are clearly not numbers.
My question is how to I modify the above code so it works on all columns except the first and the last. I am hoping that there could be a one line executable that can do this, not a loop. It would be very similar to the third line in the code, but with modifications.
Thanks in advance.
Respectfully,
LZ