R&#x27的Package ::功能的Python等效是什么?
在RI中可以通过两种不同的方式使用函数。首先是加载库,然后使用该功能。
library(dplyr)
df2 <- select(df, column)
或者,当我在不先加载软件包的情况下调用该函数时,我将其命名(虽然应该安装)。当我只使用一个来自某个软件包的一个函数时,这可以节省脚本中的空间。它还有助于阅读代码。
df2 <- dplyr::select(df, column)
在Python中,我这样做:
import pandas as pd
df = pd.DataFrame(df)
有没有办法写作:
df = pandas.DataFrame(df)
没有导入语句?
In R I can use a function in two different ways. First is to load the library and then use the function.
library(dplyr)
df2 <- select(df, column)
Or I name the package when I call the function without loading the package first (it should be installed though). This saves space in the script when I use only one function from a certain package. It also helps with reading the code.
df2 <- dplyr::select(df, column)
In python I do this:
import pandas as pd
df = pd.DataFrame(df)
Is there a way to only write:
df = pandas.DataFrame(df)
without the import statement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论