Skip to content

Commit 29e2d12

Browse files
authored
Merge pull request #320 from extradosages/fix/misspelled-disallow
@dissalowna -> @disallowna
2 parents f97e26a + db91f4e commit 29e2d12

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

docs/src/standalonequerycommands.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,18 @@ println(q)
433433
│ 2 │ 3 │ 5 │
434434
```
435435

436-
## The `@dissallowna` command
436+
## The `@disallowna` command
437437

438-
The `@dissallowna` command has the form `source |> @dissallowna(columns...)`. `source` can be any source that can be queried and that has a table structure. If `@dissallowna()` is called without any arguments, it will check that there are no missing `NA` values in any column in any row of the input table and convert the element type of each column to one that cannot hold missing values. Alternatively one can pass a list of column names to `@dissallowna`, in which case it will only check for `NA` values in those columns, and only convert those columns to a type that cannot hold missing values.
438+
The `@disallowna` command has the form `source |> @disallowna(columns...)`. `source` can be any source that can be queried and that has a table structure. If `@disallowna()` is called without any arguments, it will check that there are no missing `NA` values in any column in any row of the input table and convert the element type of each column to one that cannot hold missing values. Alternatively one can pass a list of column names to `@disallowna`, in which case it will only check for `NA` values in those columns, and only convert those columns to a type that cannot hold missing values.
439439

440-
Our first example uses the simple version of `@dissallowna()` that makes sure there are no missing values anywhere in the table. Note how the column type for column `a` is changed to `Int64` in this example, i.e. an element type that does not support missing values:
440+
Our first example uses the simple version of `@disallowna()` that makes sure there are no missing values anywhere in the table. Note how the column type for column `a` is changed to `Int64` in this example, i.e. an element type that does not support missing values:
441441

442442
```jldoctest
443443
using Query, DataFrames
444444
445445
df = DataFrame(a=[1,missing,3], b=[4,5,6])
446446
447-
q = df |> @filter(!isna(_.a)) |> @dissallowna() |> DataFrame
447+
q = df |> @filter(!isna(_.a)) |> @disallowna() |> DataFrame
448448
449449
println(q)
450450
@@ -465,7 +465,7 @@ using Query, DataFrames
465465
466466
df = DataFrame(a=[1,2,missing], b=[4,missing,5])
467467
468-
q = df |> @filter(!isna(_.b)) |> @dissallowna(:b) |> DataFrame
468+
q = df |> @filter(!isna(_.b)) |> @disallowna(:b) |> DataFrame
469469
470470
println(q)
471471

src/Query.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export @from, @query, @count, Grouping, key
1010
export @map, @filter, @groupby, @orderby, @orderby_descending, @unique,
1111
@thenby, @thenby_descending, @groupjoin, @join, @mapmany, @take, @drop
1212

13-
export @select, @rename, @mutate, @dissallowna, @dropna, @replacena
13+
export @select, @rename, @mutate, @disallowna, @dropna, @replacena
1414

1515
export isna, NA
1616

src/table_query_macros.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,20 @@ our_get(x::DataValue) = get(x)
193193
our_get(x, y) = x
194194
our_get(x::DataValue, y) = get(x, y)
195195

196-
macro dissallowna()
196+
macro disallowna()
197197
return :( Query.@map(map(our_get, _)) )
198198
end
199199

200-
macro dissallowna(columns...)
200+
macro disallowna(columns...)
201201
return :( Query.@mutate( $( ( :( $(columns[i].value) = our_get(_.$(columns[i].value)) ) for i=1:length(columns) )... ) ) )
202202
end
203203

204204
macro dropna()
205-
return :( i-> i |> Query.@filter(!any(isna, _)) |> Query.@dissallowna() )
205+
return :( i-> i |> Query.@filter(!any(isna, _)) |> Query.@disallowna() )
206206
end
207207

208208
macro dropna(columns...)
209-
return :( i-> i |> Query.@filter(!any(($((:(isna(_.$(columns[i].value))) for i in 1:length(columns) )...),))) |> Query.@dissallowna($(columns...)) )
209+
return :( i-> i |> Query.@filter(!any(($((:(isna(_.$(columns[i].value))) for i in 1:length(columns) )...),))) |> Query.@disallowna($(columns...)) )
210210
end
211211

212212
macro replacena(arg, args...)

test/test_macros.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ end
7676
@test df |> @replacena(:a=>2, :b=>8) |> collect == [(a=1,b=1.), (a=2, b=2.), (a=3, b=3.)]
7777
end
7878

79-
@testset "@dissallowna" begin
79+
@testset "@disallowna" begin
8080

8181
df = DataFrame(a=[1,missing,3], b=[1.,2.,3.])
8282

83-
@test_throws DataValueException df |> @dissallowna() |> collect
84-
@test df |> @filter(!any(isna, _)) |> @dissallowna() |> collect == [(a=1,b=1.), (a=3, b=3.)]
85-
@test_throws DataValueException df |> @dissallowna(:a) |> collect
86-
@test df |> @dissallowna(:b) |> collect == [(a=DataValue(1),b=1.), (a=DataValue{Int}(),b=2.),(a=DataValue(3), b=3.)]
83+
@test_throws DataValueException df |> @disallowna() |> collect
84+
@test df |> @filter(!any(isna, _)) |> @disallowna() |> collect == [(a=1,b=1.), (a=3, b=3.)]
85+
@test_throws DataValueException df |> @disallowna(:a) |> collect
86+
@test df |> @disallowna(:b) |> collect == [(a=DataValue(1),b=1.), (a=DataValue{Int}(),b=2.),(a=DataValue(3), b=3.)]
8787
end

0 commit comments

Comments
 (0)