Last active
August 6, 2023 15:14
-
-
Save vnegi10/93942918223213cbfce248a0ba0522a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function process_gas_df(df_all_gas::DataFrame) | |
df_gas = deepcopy(df_all_gas) | |
# Temperature is 10x in original data | |
df_gas[!, :T] = df_gas[!, :T] ./ 10 | |
# Convert from kWh to m^3 | |
conversion_factor = 0.10058 | |
df_gas[!, :ch] = df_gas[!, :ch] .* conversion_factor | |
df_gas[!, :hw] = df_gas[!, :hw] .* conversion_factor | |
# Convert to Date object | |
df_gas[!, :d] = Date.(df_gas[!, :d], "dd-mm-yyyy") | |
# Rename all colums | |
rename!(df_gas, Dict(:T => "OutsideTemperature", | |
:ch => "CentralHeating", | |
:hw => "HotWater", | |
:d => "Date")) | |
# Get column with day names | |
day = map(x -> Dates.dayname(x), df_gas[!, :Date]) | |
insertcols!(df_gas, ncol(df_gas), :Day => day) | |
return df_gas | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment