GWSurfer
GWSurfer

Reputation: 51

Can I recover a python function I mistakenly deleted in a Jupyter notebook?

I imported matplotlib.pyplot as plt, then mistakenly defined a variable with the the function matplotlib.pyplot.xticks function name (i.e. plt.xticks = ... instead of plt.xticks(...)) in a Jupyter notebook. Then I tried to undo the definition with del plt.xticks and it removed the variable, but also the function. I tried reimporting matplotlib, but still plt.xticks is not there:

plt.xticks

AttributeError: module 'matplotlib.pyplot' has no attribute 'xticks'

In other notebooks the command works, even after reimporting the library. In this specific notebook I can get around the problem by import matplotlib. Is there another way around?

Upvotes: 0

Views: 841

Answers (1)

Louis Hulot
Louis Hulot

Reputation: 395

I did the same thing once, restarting the kernel did the trick.

Upvotes: 1

Related Questions