Source, documentation, and distribution code for un-xtab.py
修訂 | 497f3b11e2d358e8ef14ea53e0824725d8dc8ccb (tree) |
---|---|
時間 | 2019-07-22 02:23:37 |
作者 | Dreas Nielsen <dreas.nielsen@gmai...> |
Commiter | Dreas Nielsen |
Fixed Markdown tables in readme and setup files.
@@ -1,84 +1,82 @@ | ||
1 | -un-xtab.py | |
2 | -Crosstabulate data in a text file. | |
3 | - | |
4 | -un-xtab.py is a Python module and command-line program that rearranges data from a crosstabulated format to a normalized format. It takes data in this form: | |
5 | - | |
6 | -======= ========== ========== ========== | |
7 | -Station 2006-05-23 2006-06-15 2006-07-19 | |
8 | -------- ---------- ---------- ---------- | |
9 | -WQ-01 4.5 3.7 6.8 | |
10 | -WQ-02 9.7 5.1 7.2 | |
11 | -WQ-03 10 6.1 8.8 | |
12 | -======= ========== ========== ========== | |
13 | - | |
14 | -and rearranges it into this form: | |
15 | - | |
16 | -======= ========== ===== | |
17 | -Station Date Value | |
18 | -------- ---------- ----- | |
19 | -WQ-01 2006-05-23 4.5 | |
20 | -WQ-02 2006-05-23 3.7 | |
21 | -WQ-03 2006-05-23 6.8 | |
22 | -WQ-01 2006-06-15 9.7 | |
23 | -WQ-02 2006-05-15 5.1 | |
24 | -WQ-03 2006-06-15 7.2 | |
25 | -WQ-01 2006-07-19 10 | |
26 | -WQ-02 2006-07-19 6.1 | |
27 | -WQ-03 2006-07-19 8.8 | |
28 | -======= ========== ===== | |
29 | - | |
30 | -Input and output are both text (CSV) files. | |
31 | - | |
32 | - | |
33 | -Syntax and Options | |
34 | -================================ | |
35 | - | |
36 | - un-xtab.py [options] input_file_name output_file_name | |
37 | - | |
38 | -Arguments: | |
39 | - Input file name The name of a text (CSV) file with crosstabbed data. | |
40 | - Output file name The name of a text (CSV) to create with normalized data. | |
41 | - | |
42 | -Options: | |
43 | - --version Show program's version number and exit | |
44 | - -h, --help Show this help message and exit | |
45 | - -c CONFIGFILE, --configfile=CONFIGFILE | |
46 | - The name of the config file, with path if necessary. | |
47 | - The default is to look for a configuration file with | |
48 | - the same name as the input file, but with an extension | |
49 | - of cfg, in the same directory as the input file. | |
50 | - -d, --displayspecs Print the format specifications allowed in the | |
51 | - configuration file, then exit. | |
52 | - -e ENCODING, --encoding=ENCODING | |
53 | - Character encoding of the CSV file. It should be one of | |
54 | - the strings listed at http://docs.python.org/library/ | |
55 | - codecs.html#standard-encodings. | |
56 | - -n ROWSEQ, --number_rows=ROWSEQ | |
57 | - Add a sequential number to each output row, with a | |
58 | - column header of ROWSEQ. | |
59 | - -o, --outputheaders Print the output column headers, then exit. | |
60 | - -p, --printconfig Pretty-print the configuration data after reading the | |
61 | - configuration file, then exit. | |
62 | - -s SPECNAME, --specname=SPECNAME | |
63 | - The name of the section to use in the configuration | |
64 | - file. The default is to use the name of the input data file, | |
65 | - without its extension. | |
66 | - | |
67 | -Complete documentation is available at `ReadTheDocs <https://un-xtab.readthedocs.io/>`_. | |
68 | - | |
69 | - | |
70 | - | |
71 | -Copyright and License | |
72 | -====================== | |
73 | - | |
74 | -Copyright (c) 2014, 2016, 2019, R.Dreas Nielsen | |
75 | - | |
76 | -This program is free software: you can redistribute it and/or modify it under | |
77 | -the terms of the GNU General Public License as published by the Free Software | |
78 | -Foundation, either version 3 of the License, or (at your option) any later | |
79 | -version. This program is distributed in the hope that it will be useful, but | |
80 | -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
81 | -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
82 | -details. The GNU General Public License is available at | |
83 | -http://www.gnu.org/licenses/. | |
84 | - | |
1 | +un-xtab.py | |
2 | +Crosstabulate data in a text file. | |
3 | + | |
4 | +un-xtab.py is a Python module and command-line program that rearranges data from a crosstabulated format to a normalized format. It takes data in this form: | |
5 | + | |
6 | +| Station | 2006-05-23 | 2006-06-15 | 2006-07-19 | | |
7 | +|---------|------------|------------|------------| | |
8 | +| WQ-01 | 4.5 | 3.7 | 6.8 | | |
9 | +| WQ-02 | 9.7 | 5.1 | 7.2 | | |
10 | +| WQ-03 | 10 | 6.1 | 8.8 | | |
11 | + | |
12 | +and rearranges it into this form: | |
13 | + | |
14 | +| Station | Date | Value | | |
15 | +| ------- | ---------- | ----- | | |
16 | +| WQ-01 | 2006-05-23 | 4.5 | | |
17 | +| WQ-02 | 2006-05-23 | 3.7 | | |
18 | +| WQ-03 | 2006-05-23 | 6.8 | | |
19 | +| WQ-01 | 2006-06-15 | 9.7 | | |
20 | +| WQ-02 | 2006-05-15 | 5.1 | | |
21 | +| WQ-03 | 2006-06-15 | 7.2 | | |
22 | +| WQ-01 | 2006-07-19 | 10 | | |
23 | +| WQ-02 | 2006-07-19 | 6.1 | | |
24 | +| WQ-03 | 2006-07-19 | 8.8 | | |
25 | + | |
26 | +Input and output are both text (CSV) files. | |
27 | + | |
28 | + | |
29 | +Syntax and Options | |
30 | +================================ | |
31 | + | |
32 | +``` | |
33 | + un-xtab.py [options] input_file_name output_file_name | |
34 | + | |
35 | +Arguments: | |
36 | + Input file name The name of a text (CSV) file with crosstabbed data. | |
37 | + Output file name The name of a text (CSV) to create with normalized data. | |
38 | + | |
39 | +Options: | |
40 | + --version Show program's version number and exit | |
41 | + -h, --help Show this help message and exit | |
42 | + -c CONFIGFILE, --configfile=CONFIGFILE | |
43 | + The name of the config file, with path if necessary. | |
44 | + The default is to look for a configuration file with | |
45 | + the same name as the input file, but with an extension | |
46 | + of cfg, in the same directory as the input file. | |
47 | + -d, --displayspecs Print the format specifications allowed in the | |
48 | + configuration file, then exit. | |
49 | + -e ENCODING, --encoding=ENCODING | |
50 | + Character encoding of the CSV file. It should be one of | |
51 | + the strings listed at http://docs.python.org/library/ | |
52 | + codecs.html#standard-encodings. | |
53 | + -n ROWSEQ, --number_rows=ROWSEQ | |
54 | + Add a sequential number to each output row, with a | |
55 | + column header of ROWSEQ. | |
56 | + -o, --outputheaders Print the output column headers, then exit. | |
57 | + -p, --printconfig Pretty-print the configuration data after reading the | |
58 | + configuration file, then exit. | |
59 | + -s SPECNAME, --specname=SPECNAME | |
60 | + The name of the section to use in the configuration | |
61 | + file. The default is to use the name of the input data file, | |
62 | + without its extension. | |
63 | +``` | |
64 | + | |
65 | +Complete documentation is available at `ReadTheDocs <https://un-xtab.readthedocs.io/>`_. | |
66 | + | |
67 | + | |
68 | + | |
69 | +Copyright and License | |
70 | +====================== | |
71 | + | |
72 | +Copyright (c) 2014, 2016, 2019, R.Dreas Nielsen | |
73 | + | |
74 | +This program is free software: you can redistribute it and/or modify it under | |
75 | +the terms of the GNU General Public License as published by the Free Software | |
76 | +Foundation, either version 3 of the License, or (at your option) any later | |
77 | +version. This program is distributed in the hope that it will be useful, but | |
78 | +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
79 | +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
80 | +details. The GNU General Public License is available at | |
81 | +http://www.gnu.org/licenses/. | |
82 | + |
@@ -1,7 +1,7 @@ | ||
1 | 1 | from distutils.core import setup |
2 | 2 | |
3 | 3 | setup(name='un-xtab', |
4 | - version='0.8.0.0', | |
4 | + version='0.8.1', | |
5 | 5 | description="Un-crosstab data in a text file.", |
6 | 6 | author='Dreas Nielsen', |
7 | 7 | author_email='dreas.nielsen@gmail.com', |
@@ -20,29 +20,25 @@ | ||
20 | 20 | long_description_content_type="text/markdown", |
21 | 21 | long_description="""``un-xtab.py`` is a Python module and command-line program that rearranges data from a crosstabulated format to a normalized format. It takes data in this form: |
22 | 22 | |
23 | -======= ========== ========== ========== | |
24 | -Station 2006-05-23 2006-06-15 2006-07-19 | |
25 | -------- ---------- ---------- ---------- | |
26 | -WQ-01 4.5 3.7 6.8 | |
27 | -WQ-02 9.7 5.1 7.2 | |
28 | -WQ-03 10 6.1 8.8 | |
29 | -======= ========== ========== ========== | |
23 | +| Station | 2006-05-23 | 2006-06-15 | 2006-07-19 | | |
24 | +|---------|------------|------------|------------| | |
25 | +| WQ-01 | 4.5 | 3.7 | 6.8 | | |
26 | +| WQ-02 | 9.7 | 5.1 | 7.2 | | |
27 | +| WQ-03 | 10 | 6.1 | 8.8 | | |
30 | 28 | |
31 | 29 | and rearranges it into this form: |
32 | 30 | |
33 | -======= ========== ===== | |
34 | -Station Date Value | |
35 | -------- ---------- ----- | |
36 | -WQ-01 2006-05-23 4.5 | |
37 | -WQ-02 2006-05-23 3.7 | |
38 | -WQ-03 2006-05-23 6.8 | |
39 | -WQ-01 2006-06-15 9.7 | |
40 | -WQ-02 2006-05-15 5.1 | |
41 | -WQ-03 2006-06-15 7.2 | |
42 | -WQ-01 2006-07-19 10 | |
43 | -WQ-02 2006-07-19 6.1 | |
44 | -WQ-03 2006-07-19 8.8 | |
45 | -======= ========== ===== | |
31 | +| Station | Date | Value | | |
32 | +| ------- | ---------- | ----- | | |
33 | +| WQ-01 | 2006-05-23 | 4.5 | | |
34 | +| WQ-02 | 2006-05-23 | 3.7 | | |
35 | +| WQ-03 | 2006-05-23 | 6.8 | | |
36 | +| WQ-01 | 2006-06-15 | 9.7 | | |
37 | +| WQ-02 | 2006-05-15 | 5.1 | | |
38 | +| WQ-03 | 2006-06-15 | 7.2 | | |
39 | +| WQ-01 | 2006-07-19 | 10 | | |
40 | +| WQ-02 | 2006-07-19 | 6.1 | | |
41 | +| WQ-03 | 2006-07-19 | 8.8 | | |
46 | 42 | |
47 | 43 | Input and output are both text (CSV) files. |
48 | 44 |