Skip to content

Path

Count the lines in Pandas Repo

from subprocess imoprt run, check_output
from pathlib import Path
from io import StringIO
from pandas import read_csv, MultiIndex, IndexSlice

d = Path("/tmp/pandas")
if not d.exists():
   run([*"git clone --depth 1 https://github.com/pandas-dev/pandas".split(),d])

s = read_csv(StringIO(check_out('find pandas -type f -iname *.* -exec wc-l {} ;'.split(), cwd=d).decode(),
    delimter=" ",
    index_col=[1],
    squeeze=True,
    names="lines path".split()
)).pipe(lambda s: s.set_axis(map(Path, s.index)))