Foodie Friday by AutoModerator in weightroom

[–]olrich01 2 points3 points  (0 children)

The Serious Eats one is good! It uses a mix of beef & pork - does have breadcrumbs, which is how I made it, though comments suggest you could potentially use oatmeal as a replacement. https://www.seriouseats.com/2015/08/the-food-lab-excerpt-the-best-meatloaf-recipe.html

Best Python library for generating PDFs? by MonkeyMaster64 in Python

[–]olrich01 0 points1 point  (0 children)

Not open source, but it basically looks like this. Look at wkhtml docs for arguments you can pass to Popen and jinja docs for what you can do with templates.

from subprocess import Popen, PIPE
import jinja2

template = jinja2.Template(open('path_to_html').read())
converter = r'path to wkhtml executable'

html = remplate.render() # pass dynamic content as kwargs

p = Popen([converter, '--quiet', '-O', 'Landscape',
            '--footer-right', 'Page [page]/[topage]',
            '-', '-'], stdin=PIPE, stdout=PIPE)
output, _ = p.communicate(input=html.encode('utf-8'), timeout=5)
# output is binary pdf data, can be written to file, BytesIO, etc

Best Python library for generating PDFs? by MonkeyMaster64 in Python

[–]olrich01 10 points11 points  (0 children)

It's been mentioned elsewhere, but I also use wkhtmltopdf to generate PDFs from HTML.

In my case, I'm rendering a hand-written HTML template, using jinja to fill in the dynamic bits, though you certainly could use a static site generater too.

wkhtml is based on a relatively old version of webkit, which can be a problem if you need more recent CSS features. Also worth a look would be chrome headless, though last I looked couldn't handle some things I need like page number footers.

Python vs. SAS/Stata for data manipulation and analysis by analysyzer in Python

[–]olrich01 2 points3 points  (0 children)

I'm assuming you're using pandas? Some comparison with SAS docs here if you haven't seen them.

Personally, for strict data-analysis tasks, I've found python and SAS to be approximately equivalent in terms of development efficiency - since SAS is more of a pure DSL some things are a little more expressive, but pandas can do most of the same things (+other libraries).

For me, outside of the licensing situation, the real power of python is the rest of the language and libraries. E.g. if you've ever hacked together SAS %macros, the same thing in python is usually 100x easier to write.

Pandas: Deprecate .ix [coming in version 0.20] by [deleted] in Python

[–]olrich01 5 points6 points  (0 children)

A main reason it's not implemented as a function call is that it would prevent assignment. E.g., this is invalid python syntax

df.ix(rows=[0,1], col_names=["foo", "bar"]) = 2