是否有可能获得命令行自动完成功能python -m package.subpackage.module?
这类似于但不一样,python ./package/subpackage/module.py它会自动完成目录和文件路径。但是-m,使用 时,python 将库的模块作为具有适当命名空间和导入路径的脚本来运行。
我希望能够python -m package.s[TAB]自动完成subpackage.
此功能是否内置于某处,或者我该如何设置?
我试图在我的docker实例中看到一个图像列表,但我不断得到一个空列表.
我跑
docker run busybox:latest echo hello
Run Code Online (Sandbox Code Playgroud)
它打印hello.我跑
docker images list --all
Run Code Online (Sandbox Code Playgroud)
它打印
REPOSITORY TAG IMAGE ID CREATED SIZE
Run Code Online (Sandbox Code Playgroud)
如果我尝试docker load -i myimage.tar列出,会发生同样的事情.为什么不显示任何图像?
docker version
Client:
Version: 17.06.1-ce
API version: 1.30
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:51:12 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:50:04 2017
OS/Arch: linux/amd64
Experimental: false
Run Code Online (Sandbox Code Playgroud) 我有一系列的清单
import pandas as pd
s = pd.Series([[1, 2, 3], [4, 5, 6]])
Run Code Online (Sandbox Code Playgroud)
我想要一个DataFrame,每列都有一个列表.
没有from_items,from_records,DataFrame Series.to_frame似乎工作.
这该怎么做?
有没有办法从命令行运行R命令?就像是
$ R --run '1+1'
2
Run Code Online (Sandbox Code Playgroud)
甚至喜欢
$ Rscript < '1+1'
2
Run Code Online (Sandbox Code Playgroud) 我正在做关于emacs lisp 的教程,它正在谈论这个let功能.
;; You can bind a value to a local variable with `let':
(let ((local-name "you"))
(switch-to-buffer-other-window "*test*")
(erase-buffer)
(hello local-name)
(other-window 1))
Run Code Online (Sandbox Code Playgroud)
我不明白let第一行后双括号的作用.他们在做什么,一套不会做?没有它们运行该部分,我收到一个错误:Wrong type argument: listp, "you".
我试图将连续变量离散化,将其分为三个等级.我想对正连续变量(在这种情况下,收入)的日志做同样的事情.
require(dplyr)
set.seed(3)
mydata = data.frame(realinc = rexp(10000))
summary(mydata)
new = mydata %>%
select(realinc) %>%
mutate(logrealinc = log(realinc),
realincTercile = cut(realinc, 3),
logrealincTercile = cut(logrealinc, 3),
realincTercileNum = as.numeric(realincTercile),
logrealincTercileNum = as.numeric(logrealincTercile))
new[sample(1:nrow(new), 10),]
Run Code Online (Sandbox Code Playgroud)
我原以为使用cut()会对每个变量(收入和对数收入)的离散因子产生相同的水平,因为log是单调函数.所以这里右边的两列应该是相等的,但这似乎不会发生.这是怎么回事?
> new[sample(1:nrow(new), 10),]
realinc logrealinc realincTercile logrealincTercile realincTercileNum logrealincTercileNum
7931 0.2967813 -1.21475972 (-0.00805,2.83] (-4.43,-1.15] 1 2
9036 0.9511824 -0.05004944 (-0.00805,2.83] (-1.15,2.15] 1 3
8204 4.5365676 1.51217069 (2.83,5.66] (-1.15,2.15] 2 3
3136 2.0610693 0.72322490 (-0.00805,2.83] (-1.15,2.15] 1 3
9708 0.9655805 -0.03502581 (-0.00805,2.83] (-1.15,2.15] 1 …Run Code Online (Sandbox Code Playgroud) 我有一个函数,例如fun(a, b = 1, c = 3, ...),它需要多个参数,其中一些具有默认值。我想使用 调用此函数lapply(X, FUN, ...),但明确指定我要提供的参数X。在上面的示例中,向量可以在 中为or or , orX提供。abcxyz...
通常我可能会打电话lapply(1:5, fun, a = 4),我想它会用作1:5论据b。
b和 use 1:5for该怎么办c?1:5怎么办?xyz...在 postgresql 中我有select col1, col2 from my_function(). 我怎样才能在 sqlalchemy 核心中做到这一点?
select(func.my_function())将结果作为字符串给出,但我想要一个元组。
在unittest样式中,我可以通过调用来测试页面是否使用特定模板assertTemplateUsed.这很有用,例如,当Django通过模板插入值时,我不能只测试字符串相等性.
我应该如何在pytest中编写等效语句?
我一直在寻找pytest-django,但不知道该怎么做.
python ×5
r ×3
autocomplete ×1
bash ×1
command-line ×1
dataframe ×1
django ×1
docker ×1
elisp ×1
emacs ×1
lapply ×1
mypy ×1
pandas ×1
parentheses ×1
postgresql ×1
pytest ×1
sql ×1
sqlalchemy ×1
type-hinting ×1