无法导入熊猫模块

时间:2018-10-03 15:27:25

标签: python pandas jupyter-notebook

我使用

成功安装了熊猫
<xsl:template match="ChangeOfAddressRcd | ConsumerIDRcd">
  <xsl:copy>
    <xsl:apply-templates select="@* | ancestor::PreciseIDServer/Header/ReferenceNumber | node()"/>
  </xsl:copy>
</xsl:template>

请注意,--user选项是必需的,因为没有遇到以下所有权错误:

Private Sub btnSearch_Click()   
On Error GoTo cmdSearchErrorTrap
Dim MySQL As String, MyCriteria As String, MyRecordSource As String
Dim ArgCount As Integer
Dim Tmp As Variant
ArgCount = 0
MySQL = "Select * from [Incoming] where "
MyCriteria = ""
AddToWhere [Title], "[Title]", MyCriteria, ArgCount
AddToWhere [RefenrenceNum], "[RefenrenceNum]", MyCriteria, ArgCount
AddToWhere [LetterNumber], "[LetterNumber]", MyCriteria, ArgCount

If MyCriteria = "" Then
MyCriteria = "True"
End If
MyRecordSource = MySQL & MyCriteria
Me!frmEmpInf.Form.RecordSource = MyRecordSource
If Me!frmEmpInf.Form.RecordsetClone.RecordCount = 0 Then
MsgBox "No records match the criteria you entered.", 48, "No Records Found"
Me!cmdClear.SetFocus
Else
'Tmp = EnableControls("Detail", True)
Me!frmEmpInf.SetFocus
End If
btnSearchResume:
Exit Sub
btnSearchErrorTrap:
MsgBox Error$
Resume btnSearchResume
End Sub

我启动了jupyter笔记本,但无法导入熊猫。其他库工作正常,例如numpy。

我怀疑这是因为python和pip不在同一个存储库中

pip install --user pandas

所以我尝试如下设置$ PYTHONPATH

Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied: '/usr/local/lib/python2.7/dist-packages/pandas'
Consider using the `--user` option or check the permissions.

但没有任何变化。这可能是一个jupyter问题,还是我做错了什么?

1 个答案:

答案 0 :(得分:0)

实际上,我是通过Jupyter笔记本电脑使用Sage的。 所以命令

f <- function(sample_size_pairs, sd_pairs) {
    return(sapply(1:nrow(sample_size_pairs), function(i) {
        mapply(rnorm, n = sample_size_pairs[i, ], sd = sd_pairs[i])
    }))
}

sample_sizes <- matrix(c(rep(c(450, 150), 3), rep(c(150, 450), 3),
                         rep(c(300, 300), 3)), ncol = 2, byrow = TRUE)
sds <- matrix(rep(c(1, 1, 1, 3, 1, 10), 3), ncol = 2, byrow = TRUE)

g <- f(sample_sizes, sds)

str(g)

List of 9
 $ :List of 2
  ..$ : num [1:450] 1.4243 1.733 0.5004 -0.8036 -0.0101 ...
  ..$ : num [1:150] -0.0607 0.1797 0.3787 -0.6676 -1.4352 ...
 $ :List of 2
  ..$ : num [1:450] -0.0766 -0.1407 -0.4893 0.2251 1.0174 ...
  ..$ : num [1:150] -1.8814 -1.3532 -1.2888 -0.0542 0.2637 ...
 $ :List of 2
  ..$ : num [1:450] 1.945 -1.375 -1.258 0.292 -0.208 ...
  ..$ : num [1:150] -1.291 -0.557 -1.199 1.385 -2.062 ...
 $ :List of 2
  ..$ : num [1:150] -2.461 -0.345 -1.454 -0.286 0.942 ...
  ..$ : num [1:450] -0.75 -0.636 -0.488 1.818 -0.585 ...
 $ :List of 2
  ..$ : num [1:150] -1.238 -0.765 -1.447 -1.153 -1.466 ...
  ..$ : num [1:450] 2.5461 0.9368 -0.0503 -0.9727 -1.4101 ...
 $ :List of 2
  ..$ : num [1:150] 0.7209 2.4342 -0.7617 0.0285 -1.3297 ...
  ..$ : num [1:450] -0.6882 0.0927 -0.8981 -0.4088 1.3421 ...
 $ : num [1:300, 1:2] 2.217 -0.161 -0.976 0.26 -0.362 ...
 $ : num [1:300, 1:2] 0.456 -0.112 -0.541 3.759 0.32 ...
 $ : num [1:300, 1:2] 0.165 0.247 -0.187 -0.624 -1.335 ...

工作正常。