这是我在编辑器中的代码:
library(sqldf)
df <- data.frame("a" = c("8600000US01770" , "8600000US01937"),
"b"= c("1,500+" , "-"),
"c"= c("***" , "**"),
"d"= c("(x)" , "(x)"),
"e"= c("(x)" , "(x)"),
"f"= c(992 , "-"))
write.csv(df, 'df_to_read.csv')
# 'df_to_read.csv' looks like this:
"","a","b","c","d","e","f"
1,8600000US01770,1,500+,***,(x),(x),992
2,8600000US01937,-,**,(x),(x),-
Housing <- file("df_to_read.csv")
Housing_filtered <- sqldf('SELECT * FROM Housing', file.format = list(eol="\n"))
当我输入import numpy
arr = numpy.random.randint(0, 2, size=10)
walk = numpy.cumsum(arr)
时,PyCharm会建议我使用numpy方法:
为什么PyCharm没有建议步行方法,我该如何解决?
答案 0 :(得分:2)
PyCharm仅在可以猜测类型或对函数本身进行注释时才显示正确的菜单。要解决此问题,您可以手动添加注释:
Python 3.6 / Pylint批注:
walk : numpy.array = numpy.cumsum(arr)
Python 2注释:
walk = numpy.cumsum(arr) # type:numpy.array
您还可以提供一个存根,以注释函数本身:
def cumsum(a, axis=None, dtype=None, out=None) -> array:
有关更多详细信息,请参见https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html