Skip to content

Commit

Permalink
fix merge when one column is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
junder873 committed Jan 5, 2022
1 parent 7f10272 commit 2f662e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WRDSMerger"
uuid = "59d27aa3-834e-4232-9046-52ef43e86786"
authors = ["junder873 <junder873@gmail.com>"]
version = "0.3.1"
version = "0.3.2"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
5 changes: 3 additions & 2 deletions src/mergeFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ end

function adjust_date_cols(df::DataFrame, table::LinkTable, date_min::Date, date_max::Date)
if ismissing(table.date_col_max) && !ismissing(table.date_col_min)
col = Dict(table.type_translations...)[table.id_cols[1]] |> string
df[!, table.date_col_min] = coalesce.(df[:, table.date_col_min], date_min)
sort!(df, [table.id_cols[1], table.date_col_min])
gdf = groupby(df, [table.id_cols[1]])
sort!(df, [col, table.date_col_min])
gdf = groupby(df, [col])
df = transform(gdf, table.date_col_min => lead => "date_max")
df[!, "date_max"] = coalesce.(df[:, "date_max"] .- Day(1), date_max)# I subtract a day since use <= later
table.date_col_max = "date_max"
Expand Down

2 comments on commit 2f662e7

@junder873
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/51849

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.2 -m "<description of version>" 2f662e70d55a1fe9a5fbc7c5cdab728b63fb04f1
git push origin v0.3.2

Please sign in to comment.