Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

ColumnName indexer on DataFrame - #2959

Merged
pgovind merged 3 commits into
dotnet:masterfrom
pgovind:indexer
Sep 2, 2020
Merged

pgovind merged 3 commits into
dotnet:masterfrom
pgovind:indexer

Conversation

@pgovind

@pgovind pgovind commented Aug 28, 2020

Copy link
Copy Markdown

Fixes #2934

This change brings back the column name indexer on DataFrame. I modified a couple test cases to test the new getter and setter.

cc @hamaze

/// <exception cref="ArgumentException">Throws if <paramref name="columnName"/> is not present in this <see cref="DataFrame"/></exception>
public DataFrameColumn this[string columnName]
{
get => Columns[columnName];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case that the column doesn't exist is handled and tested.
What's about the case of columnName = null?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it turns out, we have too many overloads of this indexer, so the only way to call this is to do df[(string)null]. I fixed the null case just in case though :)

@eerhardt eerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, after adding an exception test for columnName = null.

@pgovind
pgovind merged commit d21d665 into dotnet:master Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Column name indexing removed in .4?

3 participants