Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 hvplot 的新手,并试图.hvplot()在函数定义中包含对的调用,但它不起作用。以下代码按预期工作并显示图形:
.hvplot()
import pandas as pd import hvplot.pandas df = pd.DataFrame([1, 5, 3, 4, 2]) df.hvplot()
但如果我尝试类似:
def plot(df): df.hvplot() plot(df)
我没有输出。这是在 Jupyter Notebook 中。我错过了什么?
您需要返回函数的结果:
def plot(df): return df.hvplot() plot(df)
或者:
def plot(df): my_plot = df.hvplot() return my_plot plot(df)