-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column types get obliterated by Query.jl #313
Comments
Is there a chance that you could a) post a short snippet that creates a DataFrame with the correct columns and just 1-2 rows with sample data? Literally something like |
Hey @davidanthoff ! Yeah, let me see if I can come up with some mock data that have the same effect... |
I've observed this when using |
@extradosages |
Hi, @davidanthoff I encountered the same problem.
|
I have examined this problem furthermore. The problem seems to happen in a return type estimation of a map function that is defined in the function map(source::Enumerable, f::Function, f_expr::Expr)
TS = eltype(source)
T = Base._return_type(f, Tuple{TS,})
S = typeof(source)
Q = typeof(f)
return EnumerableMap{T,S,Q}(source, f)
end Although I'm not sure what the This is an example. using DataFrames
using QueryOperators
struct Item1
value::Union{Missing, Int64}
end
struct Item2
value::Int64
end
QueryOperators.map(QueryOperators.query([Item1(1.0)]), item -> (v = item.value, ), :()) |> DataFrame |> println
#1×1 DataFrame
# Row │ v
# │ Any
#─────┼─────
# 1 │ 1
QueryOperators.map(QueryOperators.query([Item2(1.0)]), item -> (v = item.value, ), :()) |> DataFrame |> println
#1×1 DataFrame
# Row │ v
# │ Int64
#─────┼───────
# 1 │ 1 Sorry, I'm not sure why it happens, whether this is some limitation of a type inference of the language or kind of bugs. It will be difficult to investigate the cause any further with my limited knowledge now. Anyway, I hope this will help. |
I am having the same problem on grouping on multiple columns. However |
I have a DataFrame
df
with correct column types (String, Float64, etc). However after processing with Query.jl I'm getting onlyAny
column types. Here's the suspect code snippet:Now,
brand_code_df
will have onlyAny
column types.OTOH I've found that doing
... |> collect |> DataFrame
does in fact retain the correct column types.The text was updated successfully, but these errors were encountered: