Giter VIP home page Giter VIP logo

Comments (19)

cnuernber avatar cnuernber commented on June 7, 2024

I am interested in anything :-).

Do you have a pointer to an existing pandas method?

Is this a vector->vector translation or is this a dataset->dataset translation?

I have needed this before in order to get smoother graphs for response times like for example when you have a set of responses and then no request for 5 minutes. In that case it would be useful to just duplicate the latest response time but add more values (like one every second or something).

from tech.datatype.

lccambiaghi avatar lccambiaghi commented on June 7, 2024

API:

Low level calls:

Wow, pandas code is a mess. I wouldn't know where to begin even with these pointers! It is definitely dataset to dataset. Yes your example is a fairly common use of propagating last observation to fill gaps in the index (in pandas you would call reindex(method='ffill').

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

Hi! I've made filling missing with values from previous (or from next) possible value in tablecloth here: https://scicloj.github.io/tablecloth/index.html#replace - it's also candidate to be moved to tech.ml stack.

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

Great timing :-). Yes, then we could split this up into 'reindex' that sets new rows to empty and then a replace function. Very nice.

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

Implementing hint, RoaringBitmap has nice two functions: previousAbsentValue and nextAbsentValue to find a range of missing indexes as continuous range.

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

https://github.com/scicloj/tablecloth/blob/master/src/tablecloth/api/missing.clj#L55

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

Low level attempt at this (operation works in double space):
https://github.com/techascent/tech.datatype/blob/fill-range/src/tech/v2/datatype/functional.clj#L244

from tech.datatype.

lccambiaghi avatar lccambiaghi commented on June 7, 2024

Chris, that looks great, thanks a lot! Waiting with patience for the support of datetime dtype!

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

They are sort of implicitly supported:
https://github.com/techascent/tech.datatype/blob/master/src/tech/v2/datatype/datetime/operations.clj#L945

All datetime objects have a conversion to 64bit long milliseconds. When I implement this in dataset I will take care of that conversion (and back) automatically.

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

Marking this as fixed here and filing two new bugs in dataset:
techascent/tech.ml.dataset#116
techascent/tech.ml.dataset#115

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

@lccambiaghi - tech.ml.dataset version 3.04 - When you have time it would be great to hear if tech.ml.dataset/fill-range-replace works for you.

@genmeblog - Copied your file over and exported the various functions into the tech.ml.dataset namespace. The difference here is a weaker column selection mechanism and no support for grouping. But the implementation has a public function that is private previously - replace-missing-with-strategy. The grouping and such I believe happens outside of that function. For now I wouldn't refactor; it may be better to have tablecloth work on more version of tech.ml.dataset than just the absolute most current but I did copy the code and it worked great. I may move your more sophisticated column selection criteria into tech.ml.dataset as I believe that is a solid and unambiguous upgrade to select and select-columns.

from tech.datatype.

lccambiaghi avatar lccambiaghi commented on June 7, 2024

Stupid question.. how can I specify the 'span' when I want a "day" between each entry?

BTW interestingly this code

(->  (ds/->dataset {:dt [(java.time.LocalDateTime/of 2020 01 01 0 0 0)
                         (java.time.LocalDateTime/of 2020 01 05 0 0 0)]})
     (ds/fill-range-replace :dt 1))

results in

1. Unhandled java.lang.OutOfMemoryError
   Java heap space

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

from tech.datatype.

lccambiaghi avatar lccambiaghi commented on June 7, 2024

Amazing, thank you for the pointer, I used the handy (dtype-dt/milliseconds-in-day)! I am extremely happy with the solution, thank you so much!!

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

That is great and you are very welcome! Keep em coming :-)

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

Great! Thanks @cnuernber I will switch to migrated code asap.
Regarding grouping and column selection - we can leave it in tablecloth for a while (or forever).

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

Hey Chris, why fill-range-replace not just fill-range?

from tech.datatype.

cnuernber avatar cnuernber commented on June 7, 2024

Because it does the replace-missing operation just after the fill range operation. Honestly I would love a better name in general for fill-range. interpolate-spans also didn't seem very good. All these names seem bad to me or at least extremely obtuse.

from tech.datatype.

genmeblog avatar genmeblog commented on June 7, 2024

Ah, you're right. I don't know the better name too. Pandas' reindex is also not good.

from tech.datatype.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.