Skip to content

Instantly share code, notes, and snippets.

@TeMPOraL TeMPOraL/corona Secret
Created Mar 10, 2020

Embed
What would you like to do?
let
Źródło = Csv.Document(File.Contents("C:\Users\DELL\Downloads\time_series_19-covid-Confirmed.csv"),[Delimiter=",", Columns=52, Encoding=1250, QuoteStyle=QuoteStyle.None]),
#"Zmieniono typ" = Table.TransformColumnTypes(Źródło,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}, {"Column13", type text}, {"Column14", type text}, {"Column15", type text}, {"Column16", type text}, {"Column17", type text}, {"Column18", type text}, {"Column19", type text}, {"Column20", type text}, {"Column21", type text}, {"Column22", type text}, {"Column23", type text}, {"Column24", type text}, {"Column25", type text}, {"Column26", type text}, {"Column27", type text}, {"Column28", type text}, {"Column29", type text}, {"Column30", type text}, {"Column31", type text}, {"Column32", type text}, {"Column33", type text}, {"Column34", type text}, {"Column35", type text}, {"Column36", type text}, {"Column37", type text}, {"Column38", type text}, {"Column39", type text}, {"Column40", type text}, {"Column41", type text}, {"Column42", type text}, {"Column43", type text}, {"Column44", type text}, {"Column45", type text}, {"Column46", type text}, {"Column47", type text}, {"Column48", type text}, {"Column49", type text}, {"Column50", type text}, {"Column51", type text}, {"Column52", type text}}),
#"Nagłówki o podwyższonym poziomie" = Table.PromoteHeaders(#"Zmieniono typ", [PromoteAllScalars=true]),
#"Zmieniono typ1" = Table.TransformColumnTypes(#"Nagłówki o podwyższonym poziomie",{{"Province/State", type text}, {"Country/Region", type text}, {"Lat", type text}, {"Long", type text}, {"1/22/20", Int64.Type}, {"1/23/20", Int64.Type}, {"1/24/20", Int64.Type}, {"1/25/20", Int64.Type}, {"1/26/20", Int64.Type}, {"1/27/20", Int64.Type}, {"1/28/20", Int64.Type}, {"1/29/20", Int64.Type}, {"1/30/20", Int64.Type}, {"1/31/20", Int64.Type}, {"2/1/20", Int64.Type}, {"2/2/20", Int64.Type}, {"2/3/20", Int64.Type}, {"2/4/20", Int64.Type}, {"2/5/20", Int64.Type}, {"2/6/20", Int64.Type}, {"2/7/20", Int64.Type}, {"2/8/20", Int64.Type}, {"2/9/20", Int64.Type}, {"2/10/20", Int64.Type}, {"2/11/20", Int64.Type}, {"2/12/20", Int64.Type}, {"2/13/20", Int64.Type}, {"2/14/20", Int64.Type}, {"2/15/20", Int64.Type}, {"2/16/20", Int64.Type}, {"2/17/20", Int64.Type}, {"2/18/20", Int64.Type}, {"2/19/20", Int64.Type}, {"2/20/20", Int64.Type}, {"2/21/20", Int64.Type}, {"2/22/20", Int64.Type}, {"2/23/20", Int64.Type}, {"2/24/20", Int64.Type}, {"2/25/20", Int64.Type}, {"2/26/20", Int64.Type}, {"2/27/20", Int64.Type}, {"2/28/20", Int64.Type}, {"2/29/20", Int64.Type}, {"3/1/20", Int64.Type}, {"3/2/20", Int64.Type}, {"3/3/20", Int64.Type}, {"3/4/20", Int64.Type}, {"3/5/20", Int64.Type}, {"3/6/20", Int64.Type}, {"3/7/20", Int64.Type}, {"3/8/20", Int64.Type}, {"3/9/20", Int64.Type}}),
#"Usunięto kolumny" = Table.RemoveColumns(#"Zmieniono typ1",{"Lat", "Long"}),
#"Anulowano przestawienie kolumn" = Table.UnpivotOtherColumns(#"Usunięto kolumny", {"Province/State", "Country/Region"}, "Atrybut", "Wartość"),
#"Podzielono kolumnę według ogranicznika" = Table.SplitColumn(#"Anulowano przestawienie kolumn", "Atrybut", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Atrybut.1", "Atrybut.2", "Atrybut.3"}),
#"Zmieniono typ2" = Table.TransformColumnTypes(#"Podzielono kolumnę według ogranicznika",{{"Atrybut.1", Int64.Type}, {"Atrybut.2", Int64.Type}, {"Atrybut.3", Int64.Type}}),
#"Zamieniono wartość" = Table.ReplaceValue(#"Zmieniono typ2",20,2020,Replacer.ReplaceValue,{"Atrybut.3"}),
#"Zmieniono kolejność kolumn" = Table.ReorderColumns(#"Zamieniono wartość",{"Province/State", "Country/Region", "Atrybut.3", "Atrybut.1", "Atrybut.2", "Wartość"}),
#"Scalono kolumny" = Table.CombineColumns(Table.TransformColumnTypes(#"Zmieniono kolejność kolumn", {{"Atrybut.3", type text}, {"Atrybut.1", type text}, {"Atrybut.2", type text}}, "pl-PL"),{"Atrybut.3", "Atrybut.1", "Atrybut.2"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Date"),
#"Zmieniono typ3" = Table.TransformColumnTypes(#"Scalono kolumny",{{"Date", type date}})
in
#"Zmieniono typ3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.