I extracted the year from the Date and added it as a new column to the Dataframe.
I need it to be like 2001 but it is 2001.0
Where is the .0 coming from?
This is the Output:
Datum LebensverbrauchMIN ... Lastfaktor Jahr
0 2001-01-01 00:00:00 0.001986 ... 0.249508 2001.0
1 2001-01-01 00:01:00 0.000839 ... 0.249847 2001.0
2 2001-01-01 00:02:00 0.000387 ... 0.250186 2001.0
# Read in Data
InnenTemp = ["LebensverbrauchMIN","HPT", "Innentemperatur", "Verlustleistung", "SolarEintrag", "Lastfaktor"]
Klima1min = pd.read_csv("Klima_keinPV11.csv", names=InnenTemp,
skiprows=0)
Datum = pd.read_csv("Klima_Lufttemp_GLobalstrahlung_Interpoliert_1min.csv", usecols=["Datum"],
skiprows=0)
Luft = pd.read_csv("Klima_Lufttemp_GLobalstrahlung_Interpoliert_1min.csv", usecols=["Lufttemperatur"],
skiprows=0)
frames = [Datum, Klima1min]
a = pd.concat(frames, axis=1)
a['Datum'] = pd.to_datetime(a['Datum'], format="%Y-%m-%dT%H:%M:%S")
a.set_index('Datum')
# Extract Year from Date(tried both lines)
a['Jahr'] = pd.DatetimeIndex(a['Datum']).year
#a['Jahr'] = a['Datum'].dt.year
print(a)