I am trying to read data from an online database and convert the first row to a timestamp. Although using the right format string in to_datetime, but I got the error
time data '\r' does not match format '%Y%m%d:%H%M' (match)
Here is the code:
import requests
import pandas as pd
import csv
from datetime import datetime
lat= 39 #Latitude
lon=-4 #Longitude
mountingplace = "building"
angle=15
aspect = 0
url = "https://re.jrc.ec.europa.eu/api/seriescalc?lat={}&lon={}&outputformat=csv&browser=1&startyear=2015&endyear=2016&peakpower=1&mountingplace={}&angle={}&pvcalculation=1&aspect={}&loss=5".format(lat,lon,mountingplace,angle, aspect)
pv=pd.read_csv(url, delimiter=',', lineterminator='\n', skiprows=10)#, date_parser=custom_date_parser)
pv['time']=pd.to_datetime(pv.time, format="%Y%m%d:%H%M")