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

Address remaining concerns from the 2nd DataFrame API Review - #2861

Merged
pgovind merged 4 commits into
dotnet:masterfrom
pgovind:apireview
Mar 9, 2020
Merged

pgovind merged 4 commits into
dotnet:masterfrom
pgovind:apireview

Conversation

@pgovind

@pgovind pgovind commented Mar 5, 2020

Copy link
Copy Markdown

All of these changes are from the API review. Pretty straightforward

return df.Reverse<#=method.MethodName#>(value, inPlace: false);
}

<# // There seem to be very few use cases for an API such as df.And/Or/Xor(true). #>

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.

Maybe replace very few with no use cases

return df.ReverseAdd(value);
}

public static DataFrame operator +(DataFrame df, char value)

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.

For conversational sake - could this be useful for appending a character to string columns? Or would they just use a full string in that case?

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.

2 things:

  1. This operator is on the DataFrame itself. So it'd be useful only if we had a DataFrame composed of only char columns. Even then, the current behavior is not great: 'a' + 'a' results in whatever character 194 is.
  2. Assuming you mean the same operator but defined on the DataFrameColumn type, then no, it wouldn't be useful. We'd just use the full StringDataFrameColumn in that case. We don't have the ability to go from a PrimitiveDataFrameColumn<char> -> StringDataFrameColumn yet.

return df.ReverseModulo(value);
}

public static DataFrame operator &(DataFrame df, bool value)

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.

Why are these being removed?

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.

Because it'd only be useful when we have a DataFrame composed of only Boolean columns(because &/|/^ ABoolValue don't make sense on any other column). I think the feeling in the API review was that it didn't make sense to keep this API for a corner case. The operators are still defined on the base DataFrameColumn type though, so a statement like boolColumn & true is valid.

@eerhardt

eerhardt commented Mar 6, 2020

Copy link
Copy Markdown
Member
    /// Clips values beyond the specified thresholds on numeric columns

Should the summary be updated to not say "clip" anymore?

https://docs.microsoft.com/en-us/dotnet/api/system.math.clamp?view=netcore-3.1

Uses the summary:

Returns value clamped to the inclusive range of min and max.


Refers to: src/Microsoft.Data.Analysis/DataFrame.cs:251 in 16dc6ea. [](commit_id = 16dc6ea, deletion_comment = False)

/// <param name="lower">Minimum value. All values below this threshold will be set to it</param>
/// <param name="upper">Maximum value. All values above this threshold will be set to it</param>
public DataFrame Clip<U>(U lower, U upper, bool inPlace = false)
public DataFrame Clamp<U>(U lower, U upper, bool inPlace = false)

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.

Maybe lower => min and upper => max?

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.

Yup. Changed the parameter names in the Filter too

@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.

:shipit:

@pgovind
pgovind merged commit 642be9c into dotnet:master Mar 9, 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.

2 participants