Git Product home page Git Product logo

Comments (6)

mcarans avatar mcarans commented on July 17, 2024

As mentioned in #11, including a subset of fields or excluding fields would also limit processing (ie. 1 and 2 in #9). As a user of the library, my use case is I have in mind that I want to process certain fields and ignore others. To me it is more intuitive to be able to specify that to the library than post processing the output of the library.

from flatten.

amirziai avatar amirziai commented on July 17, 2024

@mcarans let's say we have this dictionary (feel free to come up with a better example but I want us to nail down the requirements):

d = {
'a': [1,2,3],
'b': {'a': [1,2,3], 'b': [4,5,6]},
'c': 'c',
'd': {'a': 5}
}

What would you want to pass to flatten and what do you want to see in return?

from flatten.

mcarans avatar mcarans commented on July 17, 2024

I would want to pass in some way 'a' and get back from flatten 'b', 'c' and 'd' flattened. The 'a' : [1,2,3] would not be output at all. The other 'a' under 'b' and 'd' would be output ie. we only apply this at the root level.

from flatten.

amirziai avatar amirziai commented on July 17, 2024

If it's root-level and the argument you pass is the set to be filtered I think I've addressed it in #11 . Here's the documentation I wrote:
https://github.com/amirziai/flatten/tree/flatten-ignore-keys%239#ignore-root-keys

Am I missing something?

from flatten.

mcarans avatar mcarans commented on July 17, 2024

@amirziai I see that you have implemented the above which is what I would have called 1/2 from my list ie. inclusion/exclusion of fields. For 3 and 4, I meant that all fields would be included, but that these options would enable or disable flattening of those fields ie. with your example above if we disabled flattening for 'b', then our output would have a column entitled 'b' with contents {'a': [1,2,3], 'b': [4,5,6]} (ie. it is not flattened but it is outputted).

from flatten.

amirziai avatar amirziai commented on July 17, 2024

@mcarans I think I understand now. The point of flatten to me is that the resulting object has no structure (no iterables other than strings are present as values of the flat dictionary). This way you can easily pass the dictionary to Pandas. I see the use case though but I think that it should live outside of flatten. Feel free to open a new issue for it.

from flatten.

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.