import pandas as pd
import pandas_datareader.data as web
coins = pd.read_html('https://coinmarketcap.com/')
for name in coins[0][1][1:]:
print(name)
Run Code Online (Sandbox Code Playgroud)
结果在下面的错误消息中.当我打印硬币时,我得到了完整的表格,但是当我尝试获取特定信息时,它会给我这个错误消息.我知道这种格式是有效的,因为我已经从我学习的其他练习中完全复制了它,并且刚刚更改了网站.非常感谢.
C:\Users\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/Desktop/python_work/crypto/crypto_corr.py
Traceback (most recent call last):
File "C:\Users\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexes\base.py", line 2525, in get_loc
return self._engine.get_loc(key)
File "pandas\_libs\index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Desktop/python_work/crypto/crypto_corr.py", line 6, in <module>
for name …
Run Code Online (Sandbox Code Playgroud) 当我在 Travis-CI 上测试 Angular 项目时,出现了两个异常:
$ ng test
The test command requires to be run in an Angular project, but a project definition could not be found.
The command "ng test" exited with 1.
$ ng e2e
The e2e command requires to be run in an Angular project, but a project definition could not be found.
The command "ng e2e" exited with 1.
Run Code Online (Sandbox Code Playgroud)
错误消息非常令人困惑。我用谷歌搜索了“ Angular 项目定义”,但没有找到任何相关内容。
我查看了Angular CLI wiki,但没有关于ng test
和 的有用信息ng e2e
,更不用说“项目定义 …
在阅读了Git - git-submodule 文档后,我决定将以前项目中的两个文件导入到新项目的根目录中,因为我不想手动同步这两个文件。但是,当我执行以下命令时出现错误:
$ git submodule add -b master -f --name latexci -- \
https://github.com/donizyo/LaTeX-Travis.git .
fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths
usage: git submodule--helper clone [--prefix=<path>] [--quiet] [--reference <repository>] [--name <name>] [--depth <depth>] --url <url> --path <path>
--prefix <path> alternative anchor for relative paths
--path <path> where the new submodule will be cloned to
--name <string> name of the new submodule
--url <string> …
Run Code Online (Sandbox Code Playgroud) 我想监听NavigationStart事件并判断它的url
属性是否为/logout
. 如果是这样,当我的侦听器检测到正确的NavigationStart事件时,路由器应该停止触发连续事件,例如RoutesRecognized、GuardsCheckStart、ChildActivationStart等。否则路由器应该继续路由。
我不想使用组件,因为我不会显示任何/logout
视图。
import { Component, OnInit } from '@angular/core';
import { Router, NavigationStart } from '@angular/router';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {
constructor(
private router: Router,
) {
router.events.filter(event => event instanceof NavigationStart).subscribe(
(event: NavigationStart) => {
if (event.url == '/logout') {
this.logout();
// TODO stop firing successive events
}
}
);
}
ngOnInit() { …
Run Code Online (Sandbox Code Playgroud) char
在花括号中使用字符串初始化数组和不使用花括号之间有什么区别?
char arr[] = {"string"};
Run Code Online (Sandbox Code Playgroud)
要么
char arr[] = "string";
Run Code Online (Sandbox Code Playgroud)