-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
177 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "DataConvenience" | ||
uuid = "3b531cbf-ee43-4e67-8118-dca2c9372f86" | ||
authors = ["Dai ZJ <[email protected]>"] | ||
version = "0.2.2" | ||
version = "0.3.0" | ||
|
||
[deps] | ||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using DataConvenience | ||
using DataFrames | ||
df = DataFrame(col = rand(1_000_000), col1 = rand(1_000_000), col2 = rand(1_000_000)) | ||
|
||
fsort(df, :col) # sort by `:col` | ||
fsort(df, [:col1, :col2]) # sort by `:col1` and `:col2` | ||
fsort!(df, :col) # sort by `:col` # sort in-place by `:col` | ||
fsort!(df, [:col1, :col2]) # sort in-place by `:col1` and `:col2` | ||
|
||
|
||
df = DataFrame(col = rand(1_000_000), col1 = rand(1_000_000), col2 = rand(1_000_000)) | ||
|
||
using BenchmarkTools | ||
fsort_1col = @belapsed fsort($df, :col) # sort by `:col` | ||
fsort_2col = @belapsed fsort($df, [:col1, :col2]) # sort by `:col1` and `:col2` | ||
|
||
sort_1col = @belapsed sort($df, :col) # sort by `:col` | ||
sort_2col = @belapsed sort($df, [:col1, :col2]) # sort by `:col1` and `:col2` | ||
|
||
using Plots | ||
bar(["DataFrames.sort 1 col","DataFrames.sort 2 col2", "DataCon.sort 1 col","DataCon.sort 2 col2"], | ||
[sort_1col, sort_2col, fsort_1col, fsort_2col], | ||
title="DataFrames sort performance comparison", | ||
label = "seconds") | ||
|
||
|
||
using DataFrames | ||
using CSV | ||
|
||
df = DataFrame(a = rand(1_000_000), b = rand(Int8, 1_000_000), c = rand(Int8, 1_000_000)) | ||
|
||
filepath = tempname()*".csv" | ||
CSV.write(filepath, df) | ||
|
||
for chunk in CsvChunkIterator(filepath) | ||
print(describe(chunk)) | ||
end | ||
|
||
|
||
# read all column as String | ||
for chunk in CsvChunkIterator(filepath, type=String) | ||
print(describe(chunk)) | ||
end | ||
|
||
|
||
# read a three colunms csv where the column types are String, Int, Float32 | ||
for chunk in CsvChunkIterator(filepath, types=[String, Int, Float32]) | ||
print(describe(chunk)) | ||
end | ||
|
||
|
||
@replicate 10 8 | ||
|
||
|
||
x = Vector{Union{Missing, Int}}(undef, 10_000_000) | ||
|
||
cmx = count_missing(x) # this is faster | ||
|
||
cmx2 = countmissing(x) # this is faster | ||
|
||
cimx = count(ismissing, x) # the way available at base | ||
|
||
|
||
cmx == cimx # true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
cd399f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
cd399f1
There was a problem hiding this comment.
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/37645
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: