fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
924 stars 197 forks source link

add slice for frame. #445

Closed alexpantyukhin closed 5 years ago

alexpantyukhin commented 5 years ago

https://github.com/fslaborg/Deedle/issues/444

alexpantyukhin commented 5 years ago

@zyzhu What about this PR? should we merge it or close?

zyzhu commented 5 years ago

@alexpantyukhin Sorry that I didn't have too much time to spare on Deedle after summer.

Frame.slice will be handy, though it is more like loc in pandas instead of iloc by indexing with numbers.

I'll merge it and fix the documentation test timeout on Travis later. Thanks!

dsyme commented 5 years ago

@zyzhu You are doing a great job, thank you! :)

@alexpantyukhin Would you like to consider being co-maintainer too? Having two active maintainers is great if possible

alexpantyukhin commented 5 years ago

@dsyme I don't mind :) It would be great :)

dsyme commented 5 years ago

@alexpantyukhin You are now a co-admin

dsyme commented 5 years ago

@alexpantyukhin You don't yet have permission to publish the nuget packages but @zyzhu can do that, and we can give you permission if needed

alexpantyukhin commented 5 years ago

Thanks! I appreciate this.

zyzhu commented 5 years ago

@alexpantyukhin That's great! Thanks for all the contributions and more in the future!

liugaocn commented 4 years ago

But somehow, I don't see a slice option in C#. Is that only available in F#?

zyzhu commented 4 years ago

@liugaocn The F# functions are not all exposed to C# yet. They are written in SeriesExtension.fs and FrameExtension.fs. Like the following https://github.com/fslaborg/Deedle/blob/master/src/Deedle/FrameExtensions.fs#L1164

I will find some time to add them one by one in another pull.

By the way, it is very easy to write extension functions. You may send a pull request if you are interested. Thanks in advance.

Hulkstance commented 3 years ago

Are they available in C# right now?

zyzhu commented 3 years ago

Sorry that I just looked into this. As I do not write C# often, I'm not too familiar with Deedle's functions exposed in C#.

I noticed that the following C# code is equivalent to calling slicing rows and columns in F#

var actual = df.Rows[new int[] { 0, 1, 2, 3, 4 }];
var actual = df.Columns[new string[] { "Open", "High" }];

I've added the above two cases in the C# test project. https://github.com/fslaborg/Deedle/commit/71e7594de4f43bb7a421a347e894cea3325f46ef