Hello, Good Morning
I’m trying to make a immutable dataframe from a csv, but seems copycols = false parameter is not working on julia 1.7.2. Am I did in an obsolete way?
data_immutable = CSV.read("purchaseData.csv", copycols = false, DataFrame)
Code above needs to generate an immutable DataFrame
@quinnj will know best but I think you need:
DataFrame(CSV.File(“purchaseData.csv”), copycols = false)
and note that this data frame will be mutable, only its columns will be immutable.
If you need a fully immutable table just use
(this is outdated - please see @quinnj comment)
Did this, but colums are mutable. According my book, this columns should be immutable
data_immutable = DataFrame(CSV.File("purchaseData.csv"), copycols = false)
data_immutable[1, :Name] = "YARDEN"
@warn "Cannot: data_immutable is immutable" # should fail here
There is no way to get immutable columns from CSV.jl when reading with
CSV.read. In the single threaded case, normal
SentinelVector are returned, in the multithreaded case
ChainedVector of the former vector types are returned.
I think this was changed in new versions of julia. This book is not so old. It has only one year. Then, are there no way to get a imuttable DataFrame?
There has never been an immutable
DataFrame. Can you share the resource you are using? Maybe there is a misunderstanding somewhere.
Ah - right. The immutability was dropped :).
Let’s see, I think it was back in the 0.7.X releases, immutable columns were returned, but that was several years ago at this point. This material must have been based on that.
If an immutable DataFrame is really needed for some reason, you could convert the data into the Arrow.jl format; it returns immutable columns by default (the data format itself is immutable).
I’ll will need to stop buying julia books. The amount of break changes between versions are constant. I had issues with obsolescense every year.
No need to be imuttable. I was only training using a book. No problem.