title: Error when passing one function to another TypeError: 'function' object is not subscriptable
body: <p>Whenever I try to pass my function another function I get this typeError,as I need to use my first function in the parameters of this one how can I solve this??</p>
  <pre><code>
      def classify_playlist(func):
          spotify=pd.read_csv('../OUTPUT/spotify.csv')
          spotify.drop(columns=['Unnamed: 0'],inplace=True)
          spotify.columns
          y = spotify['intervals'].values
          X = spotify[['danceability', 'energy',
                  'loudness',  'speechiness', 'acousticness',
                 'instrumentalness', 'liveness', 'valence']].values
          X_train, X_test, y_train,y_test = train_test_split(X,y, test_size=0.2)
      
      
          forest = RandomForestClassifier(n_estimators=200)
          forest.fit(X_train, y_train)
          tx=func[['danceability', 'energy',
                  'loudness',  'speechiness', 'acousticness',
                 'instrumentalness', 'liveness', 'valence']].values
          testdata= forest.predict(tx)
          return testdata
      ---------------------------------------------------------------------------
      TypeError                                 Traceback (most recent call last)
      &lt;ipython-input-107-4b5cd6f1b86c&gt; in &lt;module&gt;
      ----&gt; 1 b=classify_playlist(analyze_playlist)
            2 b
      
      &lt;ipython-input-106-9d76177b031c&gt; in classify_playlist(func)
           12     forest = RandomForestClassifier(n_estimators=200)
           13     forest.fit(X_train, y_train)
      ---&gt; 14     tx=func[['danceability', 'energy',
           15             'loudness',  'speechiness', 'acousticness',
           16            'instrumentalness', 'liveness', 'valence']].values
      
      TypeError: 'function' object is not subscriptable
  
  </code></pre>
  <p>The function im passing is this one,as I need to access part of the dataframe how can I do this?</p>
  <pre><code>
      def analyze_playlist(*args):
          
          
          playlist_features_list = [&quot;artist&quot;,&quot;track_name&quot;,&quot;track_id&quot;,&quot;danceability&quot;,&quot;energy&quot;,&quot;key&quot;,&quot;loudness&quot;,&quot;mode&quot;, &quot;speechiness&quot;,'acousticness',&quot;instrumentalness&quot;,&quot;liveness&quot;,&quot;valence&quot;,&quot;tempo&quot;, &quot;duration_ms&quot;]
          
          playlist_df = pd.DataFrame(columns = playlist_features_list)
          
         
          
          playlist_tracks = sp.playlist_tracks(*args)[&quot;items&quot;]
          for track in playlist_tracks:
              
              playlist_features = {}
              
              playlist_features[&quot;artist&quot;] = track[&quot;track&quot;][&quot;artists&quot;][0][&quot;name&quot;]
              playlist_features[&quot;track_name&quot;] = track[&quot;track&quot;][&quot;name&quot;]
              playlist_features[&quot;track_id&quot;] = track[&quot;track&quot;][&quot;id&quot;]
              
          
              audio_features = sp.audio_features(playlist_features[&quot;track_id&quot;])[0]
              for feature in playlist_features_list[3:]:
                  playlist_features[feature] = audio_features[feature]
              
              
              track_df = pd.DataFrame(playlist_features, index = [0])
              playlist_df = pd.concat([playlist_df, track_df], ignore_index = True)
              
          return playlist_df```
  </code></pre>