def time_stats(df):
start_time = time.time()
当我在 VS Code 中运行此代码时,它运行良好,但是“时间”带有下划线:
如果我将鼠标悬停在那里,我会看到来自 PyLance 的错误消息,其中指出:
"time" is not defined: UndefinedVariable
我在文件开头做了,但在https://docs.python.org/3/library/time.html#time.timeimport time
中找不到线索。
我想这不是一个大问题,但由于我正在学习,我很想得到一些建议,这样我就可以从一开始就避免坏习惯。