Column names disappearing from Dataframe after MinMaxScaler transform. #323
-
Hi, after spending a day with danfo (and it doing exactly what I want) I've come to a final issue I can't seem to work out. [Browser v.0.3.4] I set up a simple new Danfo DataFrame and applied column titles, then I shifted the date column to the index (using set_index). I now have a DataFrame with names at the top, and dates down the side, perfect. Now I need to rescale my data from 0 to 1 in each column. This works fine but the resultant dataFrame has lost my column titles and my date index fields. I kind of need them for the next part of my project. Here's some code showing what I've done. Has anybody got any solutions my issue? Does my code look ok? Thank you in advance! John. P.S. It's fine to do all my rescaling/normalising with just that one line without using "transform" is it?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I've found an unelegant workaround by storing the dates, running the MinMaxScaler on the remaining values, extracting the values from the temporary normalised DataFrame, putting the dates back in to this temporary array, then creating a new DataFrame with the normalised arrays along with the correct column headers, and then shidt the dates to the index. It would be nice to know if there's a better way to do it. |
Beta Was this translation helpful? Give feedback.
-
I've now collected my code and simplified it. Here's the function I use to normalise the data within each column and then return a dataset with the same column names and indexes. I'd still be interested in hearing about other ways of doing this.
|
Beta Was this translation helpful? Give feedback.
I've now collected my code and simplified it. Here's the function I use to normalise the data within each column and then return a dataset with the same column names and indexes.
I'd still be interested in hearing about other ways of doing this.