def read_csv_from_hdfs(spark, filename):
    """Reads a csv file from HDFS.

    Parameters
    ----------
    filename
      filepath and name of csv file.

    Returns
    -------
    PySpark DataFrame
    """
    sdf = spark.read.csv(filename,
                         header=True,
                         inferSchema=True)
    
    return sdf