Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pandas as pd
- ar = np.array([['2018-03-14T10:58:20.000Z', 2],
- ['2018-03-14T11:58:20.000Z', 3],
- ['2018-03-14T12:58:20.000Z', 2],
- ['2018-03-14T13:58:20.000Z', 10],
- ['2018-03-14T14:58:20.000Z', 11],
- ['2018-03-14T15:58:20.000Z', 12],
- ['2018-03-14T16:58:20.000Z', 11],
- ['2018-03-14T17:58:20.000Z', 3],
- ['2018-03-14T18:58:20.000Z', 2],
- ['2018-03-14T19:58:20.000Z', 4],
- ])
- df = pd.DataFrame(ar, columns = ['Date', 'weight'])
- df['Date'] = pd.to_datetime(df['Date'])
- df['weight'] = df['weight'].astype(float)
- df_new = [['2018-03-14T10:58:20.000Z', 2],
- ['2018-03-14T11:58:20.000Z', 3],
- ['2018-03-14T12:58:20.000Z', 2],
- ['2018-03-14T13:58:20.000Z', 2],
- ['2018-03-14T14:58:20.000Z', 3],
- ['2018-03-14T15:58:20.000Z', 4],
- ['2018-03-14T16:58:20.000Z', 3],
- ['2018-03-14T17:58:20.000Z', 3],
- ['2018-03-14T18:58:20.000Z', 2],
- ['2018-03-14T19:58:20.000Z', 4],
- ])
Add Comment
Please, Sign In to add comment