Access behaviour for Explorer.DataFrame

You can also do:

df = Explorer.DataFrame.new(a: [1, 2, 3])

if "a" in df.names do
  # ...
end

It’s not perfect because Access is more inclusive. For example:

# Both of these work
df["a"] #=> #Explorer.Series<Polars[3] s64 [1, 2, 3]>
df[:a]  #=> #Explorer.Series<Polars[3] s64 [1, 2, 3]>

# Only the string version works
"a" in df.names #=> true
:a in df.names  #=> false

So it’s a bit of a leaky abstraction. But depending on what you’re doing it may be good enough.