BurntSushi / xsv

A fast CSV command line toolkit written in Rust.
The Unlicense
10.38k stars 323 forks source link

Feature Suggestion: forward fill #226

Open bgschiller opened 4 years ago

bgschiller commented 4 years ago

I frequently work with CSVs that look something like this:

ScoopStatus,HoursStatus,CookieDoughIndex,ShopOpen,FromulatorEnabled,NumScoopsToday,OutsideTemperatureCelcius,IndoorTemperatureCelcius
Unknown,Unknown,None,0,0,0,0.000000,0.000000
,,,,,,,
,,,,,,14.000000,
,,,,,,,
,,,,,,0.000000,1.000000
,,,,,,,
,,,,,,7.000000,4.000000
,,,,,,,
,,,,,,0.000000,10.000000

(column names are faked).

The CSV is produced from reading a binary format where an absent value represents that it has not changed since it was last printed, in order to cut down on space used. However, it's difficult to try and keep all the most recent values in your head as you scan the csv.

I'd like to write a new xsv command: ffill that "fills forward", replacing any missing values with the most recent value in that column. If I prepare a pull request with that addition, does that seem like something you'd want to include in the package?

bgschiller commented 4 years ago

Ah, I see this is already implemented in #117