Skip to content

Commit

Permalink
Properly convert headers with numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Jul 25, 2017
1 parent 67530a3 commit 3c76cdc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ExcelReaders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ function readxl_internal(::Type{DataFrame}, file::ExcelFile, sheetname::Abstract
NAcol = Bool.(isna.(headervec))
headervec[NAcol] = DataFrames.gennames(countnz(NAcol))

colnames = convert(Array{Symbol},vec(headervec))
# This somewhat complicated conditional makes sure that column names
# that are integer numbers end up without an extra ".0" as their name
colnames = [isa(i, AbstractFloat) ? ( modf(i)[1]==0.0 ? Symbol(Int(i)) : Symbol(string(i)) ) : Symbol(i) for i in vec(headervec)]
else
colnames = DataFrames.gennames(ncol)
end
Expand Down

0 comments on commit 3c76cdc

Please sign in to comment.