Giter Club home page Giter Club logo

tabletraitsutils.jl's People

Contributors

davidanthoff avatar github-actions[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

tabletraitsutils.jl's Issues

Regression in 0.7 with handling columns with only missing values

If I have a csv file like so:

col1,col2
foo,

And then do:

using DataFrames, CSVFiles
csv = load("error.csv")
df = DataFrame(csv)

Then I get the following stack trace:

ERROR: LoadError: MethodError: Cannot `convert` an object of type DataValues.DataValue{Union{}} to an object of type Missing
Closest candidates are:
  convert(::Type{Missing}, ::Any) at missing.jl:50
  convert(::Type{Union{Missing, T}}, ::DataValues.DataValue{Union{}}) where T at /home/hertz/.julia/packages/DataValues/dOAy1/src/scalar/core.jl:38
  convert(::Type{Union{Missing, T}}, ::DataValues.DataValue{T}) where T at /home/hertz/.julia/packages/DataValues/dOAy1/src/scalar/core.jl:37
  ...
Stacktrace:
 [1] convert(::Type{Missing}, ::DataValues.DataValue{Union{}}) at ./missing.jl:50
 [2] setindex!(::Array{Missing,1}, ::DataValues.DataValue{Union{}}, ::Int64) at ./array.jl:769
 [3] _fill_cols_with_length(::Tuple{Array{String,1},Array{Missing,1}}, ::TableTraitsUtils.TableIterator{NamedTuple{(:col1, :col2),Tuple{String,DataValues.DataValue{Union{}}}},Tuple{WeakRefStrings.StringArray{String,1},Array{Missing,1}}}) at /home/hertz/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:74
 [4] #create_columns_from_iterabletable#6(::Symbol, ::Symbol, ::Function, ::CSVFiles.CSVFile) at /home/hertz/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:114
 [5] #create_columns_from_iterabletable at ./none:0 [inlined]
 [6] _DataFrame(::CSVFiles.CSVFile) at /home/hertz/.julia/packages/IterableTables/T74aY/src/integrations/dataframes.jl:13
 [7] DataFrame(::CSVFiles.CSVFile) at /home/hertz/.julia/packages/IterableTables/T74aY/src/integrations/dataframes.jl:22
 [8] top-level scope at none:0
 [9] include at ./boot.jl:317 [inlined]
 [10] include_relative(::Module, ::String) at ./loading.jl:1038
 [11] include(::Module, ::String) at ./sysimg.jl:29
 [12] include(::String) at ./client.jl:398
 [13] top-level scope at none:0
in expression starting at mwe.jl:3

This used to work in 0.6. My environment is up to date:

  [5d742f6a] CSVFiles v0.9.0
  [a93c6f00] DataFrames v0.13.0
  [5789e2e9] FileIO v1.0.1
  [59287772] Formatting v0.3.2
  [739be429] MbedTLS v0.6.0
  [5fb14364] OhMyREPL v0.3.0
  [295af30f] Revise v0.6.4

Glen

Iterators don't work on 0.7 for empty DataFrames

Iterators work fine so long as you have data, but if you don't it all breaks - the problem seems to be here rather than in IterableTables - possibly that there are no columns in an empty table:

julia> using DataFrames, IterableTables

julia> df = DataFrame()
0ร—0 DataFrame

julia> it = getiterator(df)
TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}(())

julia> length(it)
ERROR: BoundsError: attempt to access ()
  at index [1]
Stacktrace:
 [1] getindex(::Tuple{}, ::Int64) at ./tuple.jl:24
 [2] length(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:27
 [3] top-level scope at none:0

julia> iterate(it)
ERROR: BoundsError: attempt to access ()
  at index [1]
Stacktrace:
 [1] getindex(::Tuple{}, ::Int64) at ./tuple.jl:24
 [2] length(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:27
 [3] macro expansion at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:41 [inlined]
 [4] iterate(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}, ::Int64) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:33 (repeats 2 times)
 [5] top-level scope at none:0

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.