mardi 2 novembre 2021

Randomly Modify Entries in CSV using Pandas

I have a CSV file containing data like this:

DateTime, product_x, product_y, product_z
2018-01-02 00:00:00,945,1318,17.12
2018-01-03 00:00:00,958,1322,17.25
...

I want to use Python and Pandas to modify the values for product_x, product_y and product_z by some random amount - say adding a random value from -3 - +3 to each, and then writing the result back to a CSV.

EDIT: I need each cell shifted by a different amount (except for random coincidences).

How do I do this please?




Aucun commentaire:

Enregistrer un commentaire