Coder Social home page Coder Social logo

Comments (6)

adriank avatar adriank commented on June 29, 2024

Thanks for kind words!

This is indeed a bug. Should be fixed today.

from objectpath.

adriank avatar adriank commented on June 29, 2024

Fixed, when you have attribute name that begins with number, $, @ or other operator use:

$.'3h' notation.

from objectpath.

adriank avatar adriank commented on June 29, 2024

BTW, can I ask you what do you use OP for? I'm always curious:).

from objectpath.

dummylabs avatar dummylabs commented on June 29, 2024

Thanks for quick reply, now it works like a charm!

About your question: for my pet project I was looking for a way to store weather information from different forecast services (openweathermap.com, forecast.io, etc.) in a consistent form suitable for further analysis. As json format differs from service to service, I need a way to bring their data to common format.

May be you can help me with the following: can be transformation described below done by an ObjectPath query?

source =  [{'dt': 1, 'rain':3}, {'dt':2, 'snow':5}] 
dest = [{'time':1, 'precip_type':'rain', 'precip_intencity':3}, {'time':2, 'precip_type':'snow', 'precip_intencity':5}]

I came up with two queries solution: one to extract repeating block of data, second query(-es) to transform each block's values using Python dictionary which holds either ObjectPath query or Python function if i need extra logic:

repeating_block_query = '$.*'
transform_block_query = {'time': '$.dt',
                  'precip_type': get_precip_type,
             'precip_intencity': get_precip_intencity}

Is there straight way to do it?

from objectpath.

adriank avatar adriank commented on June 29, 2024

Sure, but can you ask this on https://groups.google.com/forum/#!forum/objectpath or StackOverflow so that others could benefit from it? This issue is closed and not visible to anyone but us:).

from objectpath.

dummylabs avatar dummylabs commented on June 29, 2024

Ok, thanks!

from objectpath.

Related Issues (20)

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.