title: Python function inside a function
body: <p>I have some code down below. All of this was first done on Jupyter notebook and then I transferred into python file. I have a function that cleans text and when I apply:</p>
  <pre><code>df['First team_Players'] = df['First team_Players'].apply(clean_text)
  </code></pre>
  <p>the function will perform as it should. However when I create a function called all_nba_team() and try to run the clean_text function inside it, it doesn't seem to be performing this function. A little help would be appreciated :)</p>
  <pre><code>def clean_text(string):
      string = re.sub('\[.*?\]|[0-9*()^]', '', string)
      string = string.strip()
  
      return string
      
  
  def all_nba_team():
     ...
     df['First team_Players'] = df['First team_Players'].apply(clean_text)
     ...
  
     return df
  </code></pre>
  <p>Here is an example of the output of the code:
  <a href="https://i.stack.imgur.com/unPp2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/unPp2.png" alt="enter image description here" /></a></p>
  <p>And this is the output I am looking for:
  <a href="https://i.stack.imgur.com/Pq7fF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pq7fF.png" alt="enter image description here" /></a></p>