Skip to content

Commit 0d3be0b

Browse files
committed
- unique(), mad(), and iqr() are no longer auto-vectorized
- Bugfix: `@ungroup()` now preserves row-ordering (and is faster) - Bugfix: `slice_sample()` now throws an error if no `n` or `prop` keyword argument is provided - Bump minimum Julia version to 1.9
1 parent 8f8cfd0 commit 0d3be0b

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# TidierData.jl updates
22

3+
## v0.16.0 - 2024-06-07
4+
- `unique()`, `mad()`, and `iqr()` are no longer auto-vectorized
5+
- Bugfix: `@ungroup()` now preserves row-ordering (and is faster)
6+
- Bugfix: `slice_sample()` now throws an error if no `n` or `prop` keyword argument is provided
7+
- Bump minimum Julia version to 1.9
8+
39
## v0.15.2 - 2024-04-19
410
- Update Chain.jl dependency version
511

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TidierData"
22
uuid = "fe2206b3-d496-4ee9-a338-6a095c4ece80"
33
authors = ["Karandeep Singh"]
4-
version = "0.15.2"
4+
version = "0.16.0"
55

66
[deps]
77
Chain = "8be319e6-bccf-4806-a6f7-6fae938471bc"
@@ -22,7 +22,7 @@ Reexport = "0.2, 1"
2222
ShiftedArrays = "2"
2323
Statistics = "1.6"
2424
StatsBase = "0.34, 1"
25-
julia = "1.6"
25+
julia = "1.9"
2626

2727
[extras]
2828
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/TidierData.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const code = Ref{Bool}(false) # output DataFrames.jl code?
2828
const log = Ref{Bool}(false) # output tidylog output? (not yet implemented)
2929

3030
# The global do-not-vectorize "list"
31-
const not_vectorized = Ref{Vector{Symbol}}([:getindex, :rand, :esc, :Ref, :Set, :Cols, :collect, :(:), :, :lag, :lead, :ntile, :repeat, :across, :desc, :mean, :std, :var, :median, :first, :last, :minimum, :maximum, :sum, :length, :skipmissing, :quantile, :passmissing, :cumsum, :cumprod, :accumulate, :is_float, :is_integer, :is_string, :cat_rev, :cat_relevel, :cat_infreq, :cat_lump, :cat_reorder, :cat_collapse, :cat_lump_min, :cat_lump_prop, :categorical, :as_categorical, :is_categorical])
31+
const not_vectorized = Ref{Vector{Symbol}}([:getindex, :rand, :esc, :Ref, :Set, :Cols, :collect, :(:), :, :lag, :lead, :ntile, :repeat, :across, :desc, :mean, :std, :var, :median, :mad, :first, :last, :minimum, :maximum, :sum, :length, :skipmissing, :quantile, :passmissing, :cumsum, :cumprod, :accumulate, :is_float, :is_integer, :is_string, :cat_rev, :cat_relevel, :cat_infreq, :cat_lump, :cat_reorder, :cat_collapse, :cat_lump_min, :cat_lump_prop, :categorical, :as_categorical, :is_categorical, :unique, :iqr])
3232

3333
# The global do-not-escape "list"
3434
# `in`, `∈`, and `∉` should be vectorized in auto-vec but not escaped
@@ -494,7 +494,7 @@ end
494494
$docstring_ungroup
495495
"""
496496
macro ungroup(df)
497-
:(DataFrame($(esc(df))))
497+
:(transform($(esc(df)); ungroup = true))
498498
end
499499

500500
"""
@@ -542,7 +542,7 @@ macro distinct(df, exprs...)
542542
# because if the original DataFrame is grouped, it must be ungrouped
543543
# and then regrouped, so there's no need to make a copy up front.
544544
# This is because `unique()` does not work on GroupDataFrames.
545-
local df_copy = DataFrame($(esc(df)))
545+
local df_copy = transform($(esc(df)); ungroup = true)
546546
if $any_found_n
547547
transform!(df_copy, nrow => :TidierData_n)
548548
end

src/slice.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ macro slice_sample(df, exprs...)
6464
as_integer(floor(n() * $expr_dict[:prop]));
6565
replace=$replace))
6666
else
67-
@slice($(esc(df)), sample(1:n(), 1; replace=$replace))
67+
throw("Please provide either an `n` or a `prop` value as a keyword argument.")
6868
end
6969
end
7070

0 commit comments

Comments
 (0)