Repository: pandas-dev/pandas

Issue:
df summary view should show dtype associated with column, not just overall counts.



Discussion:
So 1st view should have dtype line.....

```
In [38]: DataFrame(randn(10,2))
Out[38]: 
          0         1
0  0.005503 -0.640638
1 -0.865491  1.448725
2 -1.259692 -0.973965
3  0.439085  0.390064
4  0.100232 -0.322328
5  0.820644 -1.234507
6  1.085050 -0.189603
7  0.553376  1.806583
8 -1.190961 -1.908767
9 -1.133783  0.958868

In [39]: DataFrame(randn(10,2)).info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 10 entries, 0 to 9
Data columns (total 2 columns):
0    10  non-null values
1    10  non-null values
dtypes: float64(2)
```

more like

```
In [39]: DataFrame(randn(10,2)).info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 10 entries, 0 to 9
Data columns (total 2 columns):
0    10  non-null values [datetime64[ns]]
1    10  non-null values [object]
dtypes: float64(1), object(1)
```

not so much to see if there are dtype issues, as to get an idea
of the data when the column names aren't clear

thats what I meant :)

agreed..thought this was in 0.11....oh well

+1 on this 

@cpcloud want to do this?

sure


Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -1426,10 +1426,12 @@ def info(self, verbose=True, buf=None, max_cols=None):
             if len(cols) != len(counts):  # pragma: no cover
                 raise AssertionError('Columns must equal counts (%d != %d)' %
                                      (len(cols), len(counts)))
+            dtypes = self.dtypes
             for col, count in compat.iteritems(counts):
+                dtype = dtypes[col]
                 col = com.pprint_thing(col)
                 lines.append(_put_str(col, space) +
-                             '%d  non-null values' % count)
+                             '%d non-null %s' % (count, dtype))
         else:
             lines.append(self.columns.summary(name='Columns'))
 


Test patch:
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -6018,6 +6018,21 @@ def test_info_duplicate_columns(self):
                           columns=['a', 'a', 'b', 'b'])
         frame.info(buf=io)
 
+    def test_info_shows_column_dtypes(self):
+        dtypes = ['int64', 'float64', 'datetime64[ns]', 'timedelta64[ns]',
+                  'complex128', 'object', 'bool']
+        data = {}
+        n = 10
+        for i, dtype in enumerate(dtypes):
+            data[i] = np.random.randint(2, size=n).astype(dtype)
+        df = DataFrame(data)
+        buf = StringIO()
+        df.info(buf=buf)
+        res = buf.getvalue()
+        for i, dtype in enumerate(dtypes):
+            name = '%d    %d non-null %s' % (i, n, dtype)
+            assert name in res
+
     def test_dtypes(self):
         self.mixed_frame['bool'] = self.mixed_frame['A'] > 0
         result = self.mixed_frame.dtypes
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -2741,6 +2741,12 @@ def test_fillna_raise(self):
         self.assertRaises(TypeError, s.fillna, [1, 2])
         self.assertRaises(TypeError, s.fillna, (1, 2))
 
+    def test_raise_on_info(self):
+        s = Series(np.random.randn(10))
+        with tm.assertRaises(AttributeError):
+            s.info()
+
+
 # TimeSeries-specific
 
     def test_fillna(self):