Skip to content

Commit 02e42be

Browse files
committed
UP: Wrote a docstring for subsample.py
1 parent 3d470a7 commit 02e42be

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

subsample.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,24 @@ def subsample(
9191
infile, outfile, subsample_rate=0.01, delimiter=',', key_column=None,
9292
seed=None):
9393
"""
94-
Write later, if module interface is needed.
94+
Subsample infile and write to outfile.
95+
96+
Parameters
97+
----------
98+
infile : File open in read mode
99+
File should be delimited text and have a header
100+
outfile : File open in write mode
101+
Output is written here
102+
subsample_rate : Real number in the interval [0, 1]
103+
Keep this fraction of rows/key-values
104+
delimiter : Single character string
105+
The delimiter of infile. Also used for outfile.
106+
key_column : String
107+
A column name.
108+
If given, subsample in the space of values of key_column.
109+
Otherwise, subsample in the space of rows.
110+
seed : Integer
111+
If given, use this to seed the random number generator.
95112
"""
96113
## Seed the random number generator for deterministic results
97114
if seed:

0 commit comments

Comments
 (0)