• R/O
  • SSH

un-xtab: 儲存庫摘要

Source, documentation, and distribution code for un-xtab.py


最新提交 RSS

修訂. 時間 作者 訊息
ae700301eda1 2023-01-30 06:37:34 rdnielsen tip Modified to allow letters as column identifiers for the r...
415764f4be19 2022-02-02 23:10:01 rdnielsen Cleanup
6baeae66ed1d 2022-02-02 11:09:21 rdnielsen Revisions for backwards-incompatible Python changes.
cb48afc3993f 2022-02-02 00:45:37 rdnielsen Changed to use argparse.
12e72acef901 2021-08-17 23:03:46 rdnielsen Modified setup script, and renamed to .rst.
1b85bfaf6d64 2021-08-17 11:40:51 rdnielsen Changed to seek(0) before truncating the output buffer.
5603c3971159 2021-08-17 10:08:13 rdnielsen Allowed 'data_columns' to accept letters; documentation u...
4bb4e6cc7398 2020-01-05 10:06:12 Dreas Nielsen Modified README and menu to reference OSDN instead of RTD.
ab240c76d2d7 2020-01-03 23:13:03 Dreas Nielsen Changed repository in documentation; changed version in s...
05201eb58057 2019-09-12 11:28:05 Dreas Nielsen Allowed the 'data_columns' setting to accept letter colum...

最近的標籤

名稱 修訂. 時間 作者
tip ae700301eda1 2023-01-30 06:37:34 rdnielsen

分支

名稱 修訂. 時間 作者 訊息
default ae700301eda1 2023-01-30 06:37:34 rdnielsen Modified to allow letters a...

README.rst

un-xtab.py

Crosstabulate data in a text file.

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:

Station | 2006-05-23 | 2006-06-15 | 2006-07-19 |

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 8)

Line block ends without a blank line.

|---------|------------|------------|------------| | WQ-01 | 4.5 | 3.7 | 6.8 | | WQ-02 | 9.7 | 5.1 | 7.2 | | WQ-03 | 10 | 6.1 | 8.8 |

and rearranges it into this form:

Station | Date | Value |
------- | ---------- | ----- |
WQ-01 | 2006-05-23 | 4.5 |
WQ-02 | 2006-05-23 | 3.7 |
WQ-03 | 2006-05-23 | 6.8 |
WQ-01 | 2006-06-15 | 9.7 |
WQ-02 | 2006-05-15 | 5.1 |
WQ-03 | 2006-06-15 | 7.2 |
WQ-01 | 2006-07-19 | 10 |
WQ-02 | 2006-07-19 | 6.1 |
WQ-03 | 2006-07-19 | 8.8 |

Input and output are both text (CSV) files.

Syntax and Options

```

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 34); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 34); backlink

Inline interpreted text or phrase reference start-string without end-string.

un-xtab.py [options] input_file_name output_file_name

Arguments:
Input file name The name of a text (CSV) file with crosstabbed data. Output file name The name of a text (CSV) to create with normalized data.
Options:
--version Show program's version number and exit
-h, --help Show this help message and exit
-c CONFIGFILE, --configfile=CONFIGFILE
 The name of the config file, with path if necessary. The default is to look for a configuration file with the same name as the input file, but with an extension of cfg, in the same directory as the input file.
-d, --displayspecs
 Print the format specifications allowed in the configuration file, then exit.
-e ENCODING, --encoding=ENCODING
 Character encoding of the CSV file. It should be one of the strings listed at http://docs.python.org/library/ codecs.html#standard-encodings.
-n ROWSEQ, --number_rows=ROWSEQ
 Add a sequential number to each output row, with a column header of ROWSEQ.

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 57)

Option list ends without a blank line; unexpected unindent.

-o, --outputheaders Print the output column headers, then exit. -p, --printconfig Pretty-print the configuration data after reading the

System Message: ERROR/3 (/tmp/formatreadme-rawkORGk8, line 59)

Unexpected indentation.
configuration file, then exit.

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 60)

Block quote ends without a blank line; unexpected unindent.
-s SPECNAME, --specname=SPECNAME
 The name of the section to use in the configuration file. The default is to use the name of the input data file, without its extension.

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 64)

Definition list ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 64); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/tmp/formatreadme-rawkORGk8, line 64); backlink

Inline interpreted text or phrase reference start-string without end-string.

Complete documentation is available at OSDN.

Docutils System Messages

System Message: ERROR/3 (/tmp/formatreadme-rawkORGk8, line 8); backlink

Undefined substitution referenced: "---------".

System Message: ERROR/3 (/tmp/formatreadme-rawkORGk8, line 8); backlink

Undefined substitution referenced: "------------".
Show on old repository browser