Skip to content

Commit

Permalink
Add a simpler way to do the same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
dandyrilla committed Jul 11, 2023
1 parent 7d25c38 commit a7a53fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions _posts/2017-08-14-pandas-tsv.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,15 @@ def to_tsv(df, filename, **kw):
_kw = dict(sep='\t', index=False)
_kw.update(kw)
df.to_csv(filename, **_kw)
```


```python
from functools import partial, partialmethod

import pandas as pd


pd.read_tsv = partial(pd.read_csv, sep='\t', header=0)
pd.DataFrame.to_tsv = partialmethod(pd.DataFrame.to_csv, sep='\t', index=False)
```

0 comments on commit a7a53fe

Please sign in to comment.