Giter Club home page Giter Club logo

csv_converter's People

Contributors

jwdt avatar jwodt avatar nnamdiib avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

drreeww

csv_converter's Issues

Add in "function link" handler.

This will work in a similar way to the lambda handler, but instead of including the function code within the JSON, it will just reference a python function.

{ "New Header One": { "old_column": "Old Header One", "default": "DEFAULT FOR ONE", "lambda": "lambda a, b: str(a.get(b.get('old_column'))).lower()" }, "New Header Two": { "old_column": "Old Header Two", "default": "DEFAULT FOR TWO", "funlink": "custom_python_file_or_module/custom_function" } }

It would then split the string by the forward slash, and import it using:

https://docs.python.org/3/library/importlib.html

Finally, it would run the imported function, in a similar way to the lambda one, with the following variables:

input_line - the current INPUT line
previous_input_lines - all the previous input file lines
current_output_lines - the current output dictionary, not a copy, but the actual one, so these functions are able to view values from, and make changes to previous entries.
item - the current column item in the JSON config.

It would output both the individual item it is processing, as well as the current_output_lines, which is to be updated if there are any changes.

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.