Comments (2)
The result:
val data: string = "A;B
a;1
b;2
b;2
c;3"
val bytes: byte array =
[|65uy; 59uy; 66uy; 10uy; 97uy; 59uy; 49uy; 10uy; 98uy; 59uy; 50uy; 10uy;
98uy; 59uy; 50uy; 10uy; 99uy; 59uy; 51uy|]
val stream: IO.MemoryStream
val df: Frame<int,string> =
A B
0 -> a 1
1 -> b 2
2 -> b 2
3 -> c 3
4 rows x 2 columns
0 missing values
val it: Frame<int,string> =
A B
0 -> a 1
1 -> b 2
3 -> c 3
3 rows x 2 columns
0 missing values
from deedle.
module Frame =
let inline distinctFrame (keys: 'C seq) (distColId:'C) (frame: Frame<'R, 'C>) =
let idxSource =
frame
|> Frame.mapRows (fun (i:'R) r ->
i, keys |> Seq.map r.TryGet |> Seq.toArray
)
|> fun s -> s.Values
let idx =
idxSource
|> Seq.groupBy (fun (_, g) -> g)
|> Seq.map (fun g ->
let (idx, _) = snd g |> Seq.item 0
idx
)
|> Seq.distinct
|> fun s -> Frame([distColId], [Series(s, s)])//"____distinctIdx____"
let fmj = frame.Join(idx, kind=JoinKind.Inner)
fmj.Columns.[fmj.ColumnKeys |> Seq.filter (fun v -> v <> distColId)]
let inline orderBy (mappingOrderKeys: ObjectSeries<'C> -> int) (distColId:'C) (frame: Frame<'R, 'C>) =
let idxSource =
frame
|> Frame.mapRows (fun (i:'R) r ->
mappingOrderKeys r
)
|> fun s -> Frame([distColId], [s])//"____distinctIdx____"
frame.Join(idxSource, kind=JoinKind.Inner)
|> Frame.sortRows distColId
let inline orderByCols (keys: 'C seq) (distColId:'C) (frame: Frame<'R, 'C>) =
let colValues =
frame
|> Frame.mapRowValues (fun row ->
let values =
keys
|> Seq.map (fun k ->
row.[k]
)
|> Seq.toArray
values |> Array.map (fun v -> v :?> IComparable)
)
let orderKeys =
colValues.Values
|> Seq.distinct
|> Seq.sort
|> Seq.mapi (fun i v -> v, i)
|> Map
let ordered =
colValues
|> Series.map (fun c v -> orderKeys.[v])
let appendCol =
Frame.ofColumns [distColId, ordered]
frame.Join(appendCol, kind=JoinKind.Inner)
|> Frame.sortRows distColId
orderBy & orderByCols functionality
from deedle.
Related Issues (20)
- Truncate part of a Frame HOT 1
- Sample code snippet and introduction for the fslab website HOT 2
- Signature of Matrix.dot is unnecessarily limited HOT 3
- Breaking change for Min/Max stats function between v2.1.0 and 2.1.1 HOT 2
- Frame.mapColValues is weirdly slow compared to mapping columns as series and joining with Frame.ofColumns HOT 1
- Frame.toArray2D throws a System.Format exception HOT 1
- Optionalvalue ignores culture
- "Select not supported" for GetRowsAs<'T>
- FSLab page out of date, not working HOT 1
- Unable to load text file with space seperated
- Stats.cov throws if Stats.stdDev contains missing values HOT 2
- Change melt to have optional parameters in line with Pandas DateFrame and R's data.table
- Deedle Finance.ewmVol is returning the rolling mean not the standard deviation HOT 1
- Exporting frames to a json
- Series.windowSize throws IndexOutOfRangeException when size is bigger than input series length HOT 1
- About latest .net interactive
- Frame.ofRecords fails silently when underlaying record type is internal or private
- Implement IDataView interface
- Performance of CSV writer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deedle.