import pandas as pd
from pathlib import Path
from dascore.utils.tables import ordered_rows
frame = pd.DataFrame({"sequence": ["2", "1"], "name": ["b", "a"]})
list(ordered_rows(frame, "sequence", Path("t/x.csv"))["name"])['a', 'b']
| function of dascore.utils.tables | source |
ordered_rows(
frame: DataFrame ,
column: str | None[str, None] ,
path: Path ,
)-> ‘pd.DataFrame’
Return the rows in the order the named column states, if any.
A table which names one is read by it rather than by row position, so re-sorting a spreadsheet cannot change what it means. A table which names none keeps the order it was written in.
| Parameter | Description |
|---|---|
| frame | The table to order. |
| column |
The numeric column stating the order, or None to keep the written order. |
| path | The file the table was read from, for the error message. |