cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unable to access python variables in-between shells in same notebook

sanjanag
New Contributor II

Unable to access Python variables in-between shells in the same notebook even if the entire code is written in Python. Getting error that unable to identify variable in the new cell 

4 REPLIES 4

Kumaran
Valued Contributor III
Valued Contributor III

Hi @sanjanag,

Thank you for posting the question in Databricks Community.

Can you share the minimal code for the repro?

Regards,

Kumaran

sanjanag
New Contributor II

Even Just a simple code like 
One cell : import pandas as pd
Second cell : df = pd.read_csv('path')
Error in second cell saying 'pd is not defined'

Kumaran
Valued Contributor III
Valued Contributor III

Hi @sanjanag,

Thank you for the response.

Perhaps you could try combining both codes into a single cell and then check if the issue persists. If it does, you can proceed by restarting the cluster. If the problem still persists after the restart, you may want to consider deleting the current cluster and creating a new one to see if that resolves the issue.

Siebert_Looije
Contributor

Hi, thanks for your message. 
Can you sent a screenshot of your notebook maybe?
This makes it hard to debug what could be the cause of it?
Also which runtime are you using, this could might be the issue. 
With my experience loading the pandas library should never be an issue in this way.

Kind regards,

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.