Repository: statsmodels/statsmodels

Issue:
SimpleTable - default alignment
I thought SimpleTable has right alignment of numbers by default.

Here is an example where the alignment seems to be center. I don't remember if we changed this.

```
>>> table
array([[   0,    0,    1],
       [   1,    1,    1],
       [   2,    7,    5],
       [   2,   28,   53],
       [   4,   80,  104],
       [   5,  182,  273],
       [   5,  345,  403],
       [   7,  561,  606],
       [   8,  798,  769],
       [   9, 1008,  970],
       [  10, 1147, 1021],
       [  11, 1186, 1040],
       [  11, 1124, 1015],
       [  13,  983,  893],
       [  14,  799,  775],
       [  15,  605,  640],
       [  16,  430,  482],
       [  17,  288,  329],
       [  18,  182,  218],
       [  19,  108,  139],
       [  20,   61,  104],
       [  21,   33,   59],
       [  22,   17,   28],
       [  23,    8,   20],
       [  23,    4,   19],
       [  25,    1,   11],
       [  26,    0,   13],
       [  27,    0,    2],
       [  28,    0,    1],
       [  28,    0,    2],
       [  30,    0,    0],
       [  31,    0,    1]])

>>> print SimpleTable(table, headers=['k', 'Poisson', 'Poisson mixture'], title='Poisson Prediction with Parameter Uncertainty')
Poisson Prediction with Parameter Uncertainty
==========================
k  Poisson Poisson mixture
--------------------------
0     0           1       
1     1           1       
2     7           5       
2     28          53      
4     80         104      
5    182         273      
5    345         403      
7    561         606      
8    798         769      
9    1008        970      
10   1147        1021     
11   1186        1040     
11   1124        1015     
13   983         893      
14   799         775      
15   605         640      
16   430         482      
17   288         329      
18   182         218      
19   108         139      
20    61         104      
21    33          59      
22    17          28      
23    8           20      
23    4           19      
25    1           11      
26    0           13      
27    0           2       
28    0           1       
28    0           2       
30    0           0       
31    0           1       
--------------------------
```



Discussion:
how to set alignment

```
print SimpleTable(table, headers=['k', 'Poisson', 'Poisson mixture'], 
                             title='Poisson Prediction with Parameter Uncertainty', 
                             txt_fmt=dict(data_aligns = "r"))
```

there is also `stub_align = 'r'`

I bumped into this before #1237 bb4dafae8830d56ce0e651d1fea9b8877f2d1a54


Resolving patch:
diff --git a/statsmodels/iolib/table.py b/statsmodels/iolib/table.py
--- a/statsmodels/iolib/table.py
+++ b/statsmodels/iolib/table.py
@@ -782,7 +782,7 @@ def set_datatype(self, val):
     row_dec_below=None,
     colwidths=None,
     colsep=' ',
-    data_aligns="c",
+    data_aligns="r",  # GH 1477
     # data formats
     # data_fmt="%s",  #deprecated; use data_fmts
     data_fmts=["%s"],


Test patch:
diff --git a/statsmodels/iolib/tests/test_table.py b/statsmodels/iolib/tests/test_table.py
--- a/statsmodels/iolib/tests/test_table.py
+++ b/statsmodels/iolib/tests/test_table.py
@@ -224,3 +224,20 @@ def test_regression_with_tuples(self):
                    "y_amax         0.2432      0.035      "]
 
         assert_equal(sorted(desired), sorted(interesting_lines))
+
+    def test_default_alignment(self):
+        desired = '''
+=====================
+      header1 header2
+---------------------
+stub1 1.30312    2.73
+stub2 1.95038     2.6
+---------------------
+'''
+        test1data = [[1.30312, 2.73], [1.95038, 2.6]]
+        test1stubs = ('stub1', 'stub2')
+        test1header = ('header1', 'header2')
+        actual = SimpleTable(test1data, test1header, test1stubs,
+                             txt_fmt=default_txt_fmt)
+        actual = '\n%s\n' % actual.as_text()
+        assert_equal(desired, str(actual))