Search code examples
python-3.xpandassklearn-pandas

How to load Only column names from csv file (Pandas)?


I have a large csv file and don't want to load it fully into my memory, I need to get only column names from this csv file. How to load it clearly?


Solution

  • try this:

    pd.read_csv(file_name, nrows=1).columns.tolist()