Giter Club home page Giter Club logo

Comments (7)

nalimilan avatar nalimilan commented on June 12, 2024

There's also this:

julia> @data [NA]
ERROR: no method convert(Type{None},ASCIIString)
 in setindex! at array.jl:412
 in parsedata at /home/milan/.julia/DataArrays/src/literals.jl:13
 in literaldata at /home/milan/.julia/DataArrays/src/literals.jl:44

But:

julia> @data [NA, 1]
2-element DataArray{Int64,1}:
  NA
 1  

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

This is an issue with every constructor literal we've had: NA doesn't give you enough type information to do anything sensible. We should fix it to produce DataArray{NAtype}, but that's still not worth having at the end of the day.

from dataarrays.jl.

nalimilan avatar nalimilan commented on June 12, 2024

A DataArray{NAtype} vector isn't very useful by itself, but sometimes you need it e.g. to represent a missing variable of the desired length, and when concatenated with another vector it will be promoted to a meaningful type.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

Ok. We should see if there's a sane way to fix this.

Another bug: @data [pi] sees pi as a symbol.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

I just pushed a big fix for this with bb2d5ef.

In this fix, I throw an error in response to @data [NA] to indicate a failure of type inference. We can hardcode this edge case, but I'm not sure that would be helpful since the rest of DataArrays is built around the assumption that a DataArray{NAtype} never occurs in valid code.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

Unfortunately my fix still leaves lots of stupid edge cases of its own:

julia> @data [sin(4.0), cos(7.4)]
2x2 DataArray{Any,2}:
 sin  4.0
 cos  7.4

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

Closed by f10d15f

from dataarrays.jl.

Related Issues (20)

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.