code: def _inferSchemaFromList(self, data, names=None):
          
          if not data:
              raise ValueError("can not infer schema from empty dataset")
          first = data[0]
          if type(first) is dict:
              warnings.warn("inferring schema from dict is deprecated,"
                            "please use pyspark.sql.Row instead")
          schema = reduce(_merge_type, (_infer_schema(row, names) for row in data))
          if _has_nulltype(schema):
              raise ValueError("Some of types cannot be determined after inferring")
          return schema
docs: Infer schema from list of Row or tuple.
  
          :param data: list of Row or tuple
          :param names: list of column names
          :return: :class:`pyspark.sql.types.StructType`