Repository: pandas-dev/pandas

Issue:
A future error warning and a problem with autoconversion of types 
#### Code Sample, a copy-pastable example if possible

```python
import pandas as pd
pd.DataFrame([ { 'a': 1, 'b': 2 } ]).append([ { 'a': 3 } ]) 
```
#### Problem description

**Problem 1.** The result is as expected (except for `2.0` instead of `2`, see Problem 2). 
``` 
   a    b
0  1  2.0
0  3  NaN
``` 
However, Python gives a warning 
``` 
/usr/lib/python3.7/site-packages/pandas/core/indexing.py:1472: FutureWarning: 
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
``` 
The warning suggests that this will be an exception in the future. The code seems legitimate, and as such produces the expected result. 

**Problem 2.** Another problem can be illustrated by this output: 
``` Python 
pd.DataFrame([ { 'a': 1, 'b': 2 } ]).dtypes 
``` 
``` 
a    int64
b    int64
dtype: object
``` 
``` Python 
pd.DataFrame([ { 'a': 1, 'b': 2 } ]).append([ { 'a': 3 } ]).dtypes 
``` 
``` 
a      int64
b    float64
dtype: object
``` 
Why the type of `b` is changed to Float64? 

#### Expected Output

``` 
   a    b
0  1    2
0  3  NaN

a    int64
b    int64
dtype: object

a    int64
b    int64
dtype: object
``` 

#### Output of ``pd.show_versions()`` 

``` 
python: 3.7.0.final.0
python-bits: 64
pandas: 0.23.1
``` 



Discussion:
1) seems like a bug, if you'd like to have a look
2) is as expected, see: http://pandas.pydata.org/pandas-docs/stable/gotchas.html#nan-integer-na-values-and-na-type-promotions
~**Problem 2.**~ Thanks a lot for the link, very useful information (and not just regarding the mentioned problem). Actually, never noticed the problem before, until needed to write to a database recently and this changed the type of a column in the database after adding some missing values. So, this is not an issue anymore as this is by design. 

**Problem 1.** I am not sure I can do this now. If you assign it to me, I'll remember to look into it later. This is if you have no immediate plans to look into this yourself or assign someone else. 


Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -6720,7 +6720,7 @@ def append(self, other, ignore_index=False,
         elif isinstance(other, list) and not isinstance(other[0], DataFrame):
             other = DataFrame(other)
             if (self.columns.get_indexer(other.columns) >= 0).all():
-                other = other.loc[:, self.columns]
+                other = other.reindex(columns=self.columns)
 
         from pandas.core.reshape.concat import concat
         if isinstance(other, (list, tuple)):


Test patch:
diff --git a/pandas/tests/frame/test_combine_concat.py b/pandas/tests/frame/test_combine_concat.py
--- a/pandas/tests/frame/test_combine_concat.py
+++ b/pandas/tests/frame/test_combine_concat.py
@@ -167,6 +167,21 @@ def test_append_list_of_series_dicts(self):
         expected = df.append(DataFrame(dicts), ignore_index=True, sort=True)
         assert_frame_equal(result, expected)
 
+    def test_append_missing_cols(self):
+        # GH22252
+        # exercise the conditional branch in append method where the data
+        # to be appended is a list and does not contain all columns that are in
+        # the target DataFrame
+        df = DataFrame(np.random.randn(5, 4),
+                       columns=['foo', 'bar', 'baz', 'qux'])
+
+        dicts = [{'foo': 9}, {'bar': 10}]
+        with tm.assert_produces_warning(None):
+            result = df.append(dicts, ignore_index=True, sort=True)
+
+        expected = df.append(DataFrame(dicts), ignore_index=True, sort=True)
+        assert_frame_equal(result, expected)
+
     def test_append_empty_dataframe(self):
 
         # Empty df append empty df