title: NameError: name 'isfile' is not defined
body: <p>I am trying to create a dataset with all the datasets stored in a folder.
  I have used the code below with any issues yesterday, but not it seems not working:</p>
  <pre><code>&gt; **&gt; Error:**
  &gt; ---&gt; 35 data = create_dataframe(paths)
  &gt; 
  &gt; &lt;ipython-input-21-b5315aeab0d7&gt; in create_dataframe(paths)
  &gt;      15     dataframes = {
  &gt;      16         (path, file): pd.read_csv(path + file + '.csv')
  &gt; ---&gt; 17         for path in paths
  &gt;      18         for file in get_files_in_path(path)
  &gt;      19     }
  &gt; 
  &gt; &lt;ipython-input-21-b5315aeab0d7&gt; in &lt;dictcomp&gt;(.0)
  &gt;      16         (path, file): pd.read_csv(path + file + '.csv')
  &gt;      17         for path in paths
  &gt; ---&gt; 18         for file in get_files_in_path(path)
  &gt;      19     }
  &gt;      20 
  &gt; 
  &gt; &lt;ipython-input-21-b5315aeab0d7&gt; in get_files_in_path(path)
  &gt;      11 
  &gt;      12     def get_files_in_path(path):
  &gt; ---&gt; 13         return [f.split('.')[0] for f in listdir(path) if isfile(join(path, f))]
  &gt;      14 
  &gt;      15     dataframes = {
  &gt; 
  &gt; &lt;ipython-input-21-b5315aeab0d7&gt; in &lt;listcomp&gt;(.0)
  &gt;      11 
  &gt;      12     def get_files_in_path(path):
  &gt; ---&gt; 13         return [f.split('.')[0] for f in listdir(path) if isfile(join(path, f))]
  &gt;      14 
  &gt;      15     dataframes = {
  &gt; 
  &gt; **NameError: name 'isfile' is not defined**
  </code></pre>
  <p>Could you please tell me how to fix it?</p>
  <p><strong>Code:</strong></p>
  <pre><code>from os import listdir
  from os.path import join
  import os
  
  def create_dataframe(paths):
  
      def get_files_in_path(path):
          return [f.split('.')[0] for f in listdir(path) if isfile(join(path, f))]
  
      dataframes = {
          (path, file): pd.read_csv(path + file + '.csv')
          for path in paths
          for file in get_files_in_path(path)
      }
  
      df = pd.concat(dataframes, names=['path', 'file', '_'])    
  
      return df
  </code></pre>
  <p>Following this question and answer, <a href="https://stackoverflow.com/questions/62286478/name-listdir-is-not-defined">name &#39;listdir&#39; is not defined</a>, I have also tried to change <code>os.listdir</code>, <code>os.path</code>, <code>os.isfile</code>, <code>os.path.join</code> but nothing has changed.</p>