cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
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,

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group