How do I fix tabs vs spaces in notebooks?

StephanieAlba
Databricks Employee
Databricks Employee

I am getting

IndentationError: unindent does not match any outer indentation level

because the code I pasted has tabs that are 4 spaces, but the tabs in Databricks are 2 spaces. How do I fix this? Do I have to copy and paste it back out?

VIPULJAINS
New Contributor III

try changing the python indentation

image

View solution in original post

I have changed the setting to no avail 😞 However, I highlighted everything and shift+tab until it hit the left margin and then tabbed it back out. This likely worked because the issue was on the outermost indentation level. In the future, this should be better.

Zainaboladokun
New Contributor III

Nopu