Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've often done this, usually not for a large dataset, but it's sometimes helpful to pipe text through Unix commands in Emacs. C-u M-| sort, for instance, will run the selection through sort and replace it in place.

If you're going the all python route, and even want to be able to run bash commands, and want something where you can feed the output into the input, I'd strongly recommend jupyter. (If you want to stay in a terminal, ipython is part of jupyter and heavily upgrades the built-in REPL and does 90% of what I'm mentioning here.)

You can break out each step into its own cell, save variables (though cell 5 will be auto-saved as a variable named _5) but the nicest thing is you can move cells around (check the keyboard shortcuts) and restart the entire kernel and rerun all your operations, essentially what you're getting with a long pipeline, only spread out over parts. And there are shortcuts like func? to pop up help on a function or func?? to see the source.

It's got some dependencies, so I'd recommend running it in a virtualenv via pipenv:

    pipenv install jupyter  # setup new virtualenv and add package
    pipenv run jupyter notebook
    pipenv --rm  # Blow away the virtualenv
Also, look into pandas if you want to slurp a CSV and query it.


I doubt you'll find many Emacs users that would prefer "C-u M-| sort" over "M-x sort-lines".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: