larsyencken / csvdiff

Generate a diff between two tabular datasets expressed in CSV files.
BSD 3-Clause "New" or "Revised" License
132 stars 31 forks source link

How to Use Package in Project? #8

Closed GokulReddy closed 9 years ago

GokulReddy commented 9 years ago

I found this package to be too good for the folks who deal with the files. I loved it. But the difficulty which i am facing it is how to use this package in my project? instead of running from the terminal? csvdiff --style=summary id a.csv b.csv -- I dont want to use like this

It would be great helpfull if you help me in executing the package in way which i specified below.. import csvdiff csvdiff.csvdiff_cmd(id,a.csv,b.csv,--style="summary")

I should execute this package in another .py file

larsyencken commented 9 years ago

You can do something like this:

import csvdiff
diff = csvdiff.diff_files('a.csv', b.csv', ['id'])

Now diff is the full JSON patch record. You can print your own summary of changes from that.

Otherwise, have a quick look at the what the '--style=summary' command is doing: https://github.com/larsyencken/csvdiff/blob/master/csvdiff/__init__.py#L159

You can pretty much do the same thing in your code. Does that help?

GokulReddy commented 9 years ago

Thank you.. That really works! Really having fun with this package.good work.

Regards, Gokul On 24 Mar 2015 8:30 am, "Lars Yencken" notifications@github.com wrote:

You can do something like this:

import csvdiff diff = csvdiff.diff_files('a.csv', b.csv', ['id'])

Now diff is the full JSON patch record. You can print your own summary of changes from that.

Otherwise, have a quick look at the what the '--style=summary' command is doing: https://github.com/larsyencken/csvdiff/blob/master/csvdiff/__init__.py#L159

You can pretty much do the same thing in your code. Does that help?

— Reply to this email directly or view it on GitHub https://github.com/larsyencken/csvdiff/issues/8#issuecomment-85318267.

larsyencken commented 9 years ago

Thanks, glad you're enjoying it!