Skip to content

Clean DataFrame meaningless code #6761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Microsoft.Data.Analysis/DataFrame.IO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ public static DataFrame LoadFrom(IEnumerable<IList<object>> vals, IList<(string,

foreach (var items in vals)
{
for (var c = 0; c < items.Count; c++)
{
items[c] = items[c];
}
res.Append(items, inPlace: true);
}

Expand Down
30 changes: 1 addition & 29 deletions src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,6 @@ internal partial class PrimitiveColumnContainer<T> : IEnumerable<T?>
// Need a way to differentiate between columns initialized with default values and those with null values in SetValidityBit
internal bool _modifyNullCountWhileIndexing = true;

public PrimitiveColumnContainer(T[] values)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can always bring it back if we need it?

Thanks for finding and cleaning up :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, it can be returned back anytime we want.
And actually these 2 issues were found by @nodakai, not by me :)

{
values = values ?? throw new ArgumentNullException(nameof(values));
long length = values.LongLength;
DataFrameBuffer<T> curBuffer;
if (Buffers.Count == 0)
{
curBuffer = new DataFrameBuffer<T>();
Buffers.Add(curBuffer);
NullBitMapBuffers.Add(new DataFrameBuffer<byte>());
}
else
{
curBuffer = (DataFrameBuffer<T>)Buffers[Buffers.Count - 1];
}
for (long i = 0; i < length; i++)
{
if (curBuffer.Length == ReadOnlyDataFrameBuffer<T>.MaxCapacity)
{
curBuffer = new DataFrameBuffer<T>();
Buffers.Add(curBuffer);
NullBitMapBuffers.Add(new DataFrameBuffer<byte>());
}
curBuffer.Append(values[i]);
SetValidityBit(Length, true);
Length++;
}
}

public PrimitiveColumnContainer(IEnumerable<T> values)
{
values = values ?? throw new ArgumentNullException(nameof(values));
Expand All @@ -81,6 +52,7 @@ public PrimitiveColumnContainer(IEnumerable<T> values)
Append(value);
}
}

public PrimitiveColumnContainer(IEnumerable<T?> values)
{
values = values ?? throw new ArgumentNullException(nameof(values));
Expand Down