'Loads a pandas DataFrame into hive.
Hive data types will be inferred if not passed but column names will
not be sanitized.
:param table: target Hive table, use dot notation to target a
specific database
:type table: str
:param create: whether to create the table if it doesn\'t exist
:type create: bool
:param recreate: whether to drop and recreate the table at every
execution
:type recreate: bool
:param field_dict: mapping from column name to hive data type
:type field_dict: dict
:param encoding: string encoding to use when writing DataFrame to file
:type encoding: str
:param pandas_kwargs: passed to DataFrame.to_csv
:type pandas_kwargs: dict
:param kwargs: passed to self.load_file'

def load_df(self, df, table, create=True, recreate=False, field_dict=None, delimiter=',', encoding='utf8', pandas_kwargs=None, **kwargs):

    def _infer_field_types_from_df(df):
        DTYPE_KIND_HIVE_TYPE = {'b': 'BOOLEAN', 'i': 'BIGINT', 'u': 'BIGINT', 'f': 'DOUBLE', 'c': 'STRING', 'O': 'STRING', 'S': 'STRING', 'U': 'STRING', 'V': 'STRING'}
        return dict(((col, DTYPE_KIND_HIVE_TYPE[dtype.kind]) for (col, dtype) in df.dtypes.iteritems()))
    if (pandas_kwargs is None):
        pandas_kwargs = {}
    with TemporaryDirectory(prefix='airflow_hiveop_') as tmp_dir:
        with NamedTemporaryFile(dir=tmp_dir) as f:
            if ((field_dict is None) and (create or recreate)):
                field_dict = _infer_field_types_from_df(df)
            df.to_csv(f, sep=delimiter, **pandas_kwargs)
            return self.load_file(filepath=f.name, table=table, delimiter=delimiter, field_dict=field_dict, **kwargs)
