Created
July 2, 2020 08:45
-
-
Save Adityanagraj/6fca7d6458f92a4b343ca44688d0f8cc to your computer and use it in GitHub Desktop.
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
def dataframe_to_arrays(dataframe): | |
# Make a copy of the original dataframe | |
data1 = data.copy(deep=True) | |
# Convert non-numeric categorical columns to numbers | |
for col in categorical_cols: | |
data1[col] = data1[col].astype('category').cat.codes | |
# Extract input & outupts as numpy arrays | |
inputs_array = data1[input_cols].to_numpy() | |
targets_array = data1[output_cols].to_numpy() | |
return inputs_array, targets_array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment