elixir-explorer/explorer

Support single `on` option in `Dataframe.join`

pcapel opened this issue · 1 comments

I'm curious what you're thoughts are on:

  1. Allowing a single value as valid (as opposed to a list) in join (e.g. DF.join(df, on: :some_column) becomes valid)
  2. Giving an argument error when a list isn't given.

I was quickly moving through the docs and didn't notice the given examples all used a list of column names. The exception that is raised here is not very intuitive:

** (CaseClauseError) no case clause matching: {:fips, :inner}
    (explorer 0.8.0) lib/explorer/data_frame.ex:4931: Explorer.DataFrame.join/3
    #cell:rr454i5svjo3vvcp:1: (file)

Where in this case :fips is the column I would like to use. It seems like updating the case could work. Alternatively the case could default to an error that explains the issue more clearly.

In my opinion, allowing a single column value seems like the reasonable behavior. Happy to write up a PR for either case.

Good idea. We should wrap the on option with List.wrap :)