Panda: read csv datetime

From OnnoWiki
Revision as of 08:35, 7 August 2019 by Onnowpurbo (talk | contribs) (Created page with " import numpy as np import matplotlib.pyplot as plt import pandas as pd infile = '/home/onno/TensorFlow/TEMP-train.csv' mydateparser = lambda x: pd.datetime.strptime(x...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

infile = '/home/onno/TensorFlow/TEMP-train.csv'
mydateparser = lambda x: pd.datetime.strptime(x, "%Y-%m-%d %H:%M:%S")
df = pd.read_csv(infile, sep=',', names=['datetime', 'value'], parse_dates=['datetime'], date_parser=mydateparser)