Skip to content

Instantly share code, notes, and snippets.

@deldersveld
Last active February 2, 2024 14:29
Show Gist options
  • Save deldersveld/5bf69c52601a11d6b843c8438cc3c7b7 to your computer and use it in GitHub Desktop.
Save deldersveld/5bf69c52601a11d6b843c8438cc3c7b7 to your computer and use it in GitHub Desktop.
American Time Use Survey - Activity Lexicon from PDF
let
FilePath = "[replace with folder path]\tabula-lexiconnoex0315.csv",
Source = Csv.Document(File.Contents(FilePath),[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.Csv]),
#"Removed Top Rows" = Table.Skip(Source,1),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each ([#"Major #(cr)category"] <> "ATUS 2003-2015 Activity coding lexicon" and [#"Major #(cr)category"] <> "Major #(cr)category")),
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows","",null,Replacer.ReplaceValue,{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}),
#"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([#"6-digit #(cr)activity #(cr)code"] <> "")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"", "_1"})
in
#"Removed Columns"
@igorabdo
Copy link

It's a great job.

@8Jimmy
Copy link

8Jimmy commented Feb 2, 2024

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment