diff --git a/modin/core/io/text/text_file_dispatcher.py b/modin/core/io/text/text_file_dispatcher.py index abb89de5ff0..99bcba2e372 100644 --- a/modin/core/io/text/text_file_dispatcher.py +++ b/modin/core/io/text/text_file_dispatcher.py @@ -1060,12 +1060,12 @@ def _read(cls, filepath_or_buffer, **kwargs): and pre_reading == 0 ) read_callback_kw = dict(kwargs, nrows=1, skipfooter=0, index_col=index_col) + pd_df_metadata = cls.read_callback( + filepath_or_buffer_md, + **read_callback_kw, + ) + column_names = pd_df_metadata.columns if not can_compute_metadata_while_skipping_rows: - pd_df_metadata = cls.read_callback( - filepath_or_buffer_md, - **read_callback_kw, - ) - column_names = pd_df_metadata.columns read_callback_kw = None else: read_callback_kw = dict(read_callback_kw, skiprows=None)