transtab icon indicating copy to clipboard operation
transtab copied to clipboard

NameError: free variable 'bin_cols' referenced before assignment in enclosing scope

Open Travisma2233 opened this issue 2 years ago • 3 comments

NameError: free variable 'bin_cols' referenced before assignment in enclosing scope What should I do?

Travisma2233 avatar Oct 09 '23 15:10 Travisma2233

@Travisma2233 Hello, Were you able to solve this?

kawseribn avatar Mar 18 '24 21:03 kawseribn

did you meet this error when you use load_data function ?

feymanwang avatar May 08 '24 09:05 feymanwang

The reason is that the bin_cols variable is first declared inside the if statement, but is used again outside the if statement. This is a feature of Python variables. You can just declare bin_cols = [] before the if statement.

dedicate487 avatar Jul 06 '24 12:07 dedicate487