我正在关注Wes McKinney的一本书,在介绍大熊猫的部分中,他给出了一个绘制大熊猫数据框的简单例子.这是我写的行:
tz_counts = frame['tz'].value_counts() # frame is a Data Frame
tz_counts[:10] # works fine till here. I can see the key-value I wanted
tz_counts[:10].plot(kind='barh', rot=0)
Run Code Online (Sandbox Code Playgroud)
它只是在屏幕上打印一条线说
<matplotlib.axes.AxesSubplot object at 0x3d14ed0>
Run Code Online (Sandbox Code Playgroud)
而不是像matplotlib的绘图功能那样显示一个绘图窗口.这有什么不对?我怎样才能使它工作?
假设我有这样一个类: -
class MyClass:
some object here
some other object here
def init(self, some parameters):
do something
def some_other_method(self, param):
something else
def save(self, path):
PICKLE DUMP THIS OBJECT
def load(self, path):
PICKLE LOAD OBJECT
Run Code Online (Sandbox Code Playgroud)
我不想腌制加载和转储像:
obj = MyClass(param)
pickle.dump(obj, mypath)
Run Code Online (Sandbox Code Playgroud)
但是这样:
obj.save(mypath)
Run Code Online (Sandbox Code Playgroud)
如何在类定义中执行此操作?
我正在使用lit-element开发自定义元素。我想制作自己的自定义表格元素,但有一些问题。
第一的。浏览器似乎只允许tr标签。tdtable
<!-- in html -->
<my-table>
<tr>
<td>A</td>
<td>B</td>
</tr>
</my-table>
<!-- chrome rendered -->
<my-table> A B </my-table>
Run Code Online (Sandbox Code Playgroud)
第二。它可以模仿CSS,但CSS无法实现colspan。
<my-table> <!-- display: table -->
<my-tr> <!-- display: table-row -->
<my-td>A</my-td> <!-- display: table-cell -->
<my-td colspan="3">B</my-td> <!-- There is no way to implement colspan -->
</my-tr>
</my-table>
Run Code Online (Sandbox Code Playgroud)
第三。我尝试在主机上使用“显示:内容”进行样式设置。这似乎有效,但主机没有像clientHeight.
class MyTd extends LitElement {
render() {
return html`
<style>
:host { display: content; }
td {
all: inherit; /* It make …Run Code Online (Sandbox Code Playgroud) 我刚在浏览器上试过这段代码(Chrome 39,Windows 8): -
<html>
<body>
<script>
<!--
document.write("<h1>Hello</h1>");
-->
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这会在浏览器上生成标题文本.但是当我稍作修改时 - 将HTML注释内容放在一行上,
<html>
<body>
<script>
<!-- document.write("<h1>Hello</h1>"); -->
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这不会显示任何内容.为什么会这样?我认为HTML评论不符合Javascript标准.
ps我知道如何把javascript评论.我只是想知道这种不稳定的行为.
几个月前我使用了一个docker文件:(1)使用基本的ubuntu映像,(2)安装miniconda python发行版,(3)使用miniconda安装一些python库,(4)运行以下命令为python设置cassandra-driver.
RUN pip install --upgrade pip
RUN pip install cassandra-driver
Run Code Online (Sandbox Code Playgroud)
这在六个月前完美运作.但是现在我得到了这个例外.
Step 13 : RUN pip install cassandra-driver
---> Running in ba9955650d7c
Collecting cassandra-driver
Downloading cassandra-driver-3.0.0.tar.gz (186kB)
Complete output from command python setup.py egg_info:
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'
unable to execute 'gcc': No such file or directory …Run Code Online (Sandbox Code Playgroud) 我有一组文本文档,其中包含多种语言的文本.
对于我读过的每一行,我必须找出它所写的语言.这仅限于三种语言,即英语,印地语(U + 0900-U + 097F)和泰卢固语(U + 0C00-U + 0C7F) .
如何让程序过滤不同脚本的行?
python ×4
html ×2
cassandra ×1
class ×1
comments ×1
css ×1
docker ×1
installation ×1
javascript ×1
lit-element ×1
matplotlib ×1
oop ×1
pandas ×1
pickle ×1
plot ×1
polymer ×1
setuptools ×1
unicode ×1