def _generate_bq_schema(df, default_type='STRING'):
 type_mapping = {'i': 'INTEGER', 'b': 'BOOLEAN', 'f': 'FLOAT', 'O': 'STRING', 'S': 'STRING', 'U': 'STRING', 'M': 'TIMESTAMP'}
 fields = []
 for (column_name, dtype) in df.dtypes.iteritems():
  fields.append({'name': column_name, 'type': type_mapping.get(dtype.kind, default_type)})
 return {'fields': fields}

def _generate_bq_schema ( df , default_type = 'STRING' ) : type_mapping = { 'i' : 'INTEGER' , 'b' : 'BOOLEAN' , 'f' : 'FLOAT' , 'O' : 'STRING' , 'S' : 'STRING' , 'U' : 'STRING' , 'M' : 'TIMESTAMP' } fields = [ ] for ( column_name , dtype ) in df . dtypes . iteritems ( ) : fields . append ( { 'name' : column_name , 'type' : type_mapping . get ( dtype . kind , default_type ) } ) return { 'fields' : fields }
given a passed df .