Skip to content

Instantly share code, notes, and snippets.

@HSShashank
Created August 25, 2021 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HSShashank/826724da30aa563bb32428dbc736008b to your computer and use it in GitHub Desktop.
Save HSShashank/826724da30aa563bb32428dbc736008b to your computer and use it in GitHub Desktop.
classes = list(np.unique(labels))
print(classes)
map_classes = dict(zip(classes, [t for t in range(len(classes))]))
print(map_classes)
df['MAPPED LABELS'] = [map_classes[i] for i in df['LABEL']]
df = df.sample(frac = 1) #To randomly shuffle the data
df.to_csv('dataset.csv')
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment