鍍金池/ 問答/ 數(shù)據(jù)分析&挖掘問答
奧特蛋 回答

slice只是第一層拷貝,對于第二層而言還是淺拷貝,請用JSON.parse(JSON.stringify(this.sortAry))

            var tempAry = JSON.parse(JSON.stringify(this.sortAry));
            tempAry[0].sortTag = '8080';
    
祉小皓 回答

因?yàn)閞ead_csv的第一個(gè)參數(shù)是:

filepath_or_buffer : str, pathlib.Path, py._path.local.LocalPath or any object with a read() method (such as a file handle or StringIO)

所以可以接受open之后的io對象,而open函數(shù)是支持中文名字的,所以不會出現(xiàn)打開錯(cuò)誤

陪妳哭 回答

這個(gè)你應(yīng)該找爬蟲來做,而不是js。爬蟲是專門做這種事情的,花個(gè)上萬月薪請一個(gè)python工程師吧。股票網(wǎng)站是屬于非常難爬的類型網(wǎng)站。

怣痛 回答

知乎上有人碰到同樣的問題,答案如下:

#!/usr/bin/python3
# -*- coding:utf8 -*-
import codecs

open("filename",'w',encoding="utf8")
愛礙唉 回答

很久沒有看到問得這么詳細(xì)的問題了,不過你只不過是缺少了一個(gè)請求頭

import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}

r = requests.get('http://music.163.com/api/playlist/detail?id=108101671', headers=headers)
print r.text
離夢 回答

在定位語句前面time.sleep一下試試

薔薇花 回答

ES7環(huán)境

b = a.reduce((origin, next) => origin.concat(next), []).reduce((origin, next) => {
    let index = origin.findIndex(item => item.some(element => element.id === next.id));
    index >= 0 ? origin[index].push(next) : origin.push([next]);
    return origin;
}, []);

Lodash

let b = _.flatten(a).reduce((origin, next) => {
    let index = _.findIndex(origin, item => item.some(element => element.id === next.id));
    index >= 0 ? origin[index].push(next) : origin.push([next]);
    return origin;
}, []);
久愛她 回答

讀取excel時(shí)候,增加encoding屬性,改改看,

dataframe = pd.read_excel(file_url, header=1,skiprows=1,encoding='utf-8')
或者
dataframe = pd.read_excel(file_url, header=1,skiprows=1,encoding='iso-8859-1')
來守候 回答

你確定是自己搭建的嗎?一般都是買的吧...
以商用為目的的爬蟲(比如爬xiecheng數(shù)據(jù))只靠幾臺服務(wù)器速度遠(yuǎn)遠(yuǎn)不夠,所以都是買大量的代理服務(wù)器地址(自己搭幾十個(gè)代理成本太高),即使其中被封了一部分也還有許多能用...
自己搭建要么是學(xué)習(xí)要么數(shù)據(jù)量小吧

遲月 回答

python3

np.vsplit( df,np.where(df.ActionType==1)[0][1:])
若相惜 回答

登錄接口里不需要參數(shù)signature。
密碼是md5加密的。
"""
g = 'veenike';
c.isValidate && (c.password = md5(c.password), c.password = md5(g + c.password + g)
"""
先對你輸入的密碼md5加密,得到的字符串首尾再增加個(gè)veenike,得到的新字符串再md5。

離殤 回答

$數(shù)組3 = array_merge($數(shù)組1, $數(shù)組2);

我甘愿 回答

已實(shí)現(xiàn)

from matplotlib import colors
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
cmap = colors.ListedColormap(['white','gray','blue','yellow'])
bounds=[0, 2, 4, 6, 8]
norm = colors.BoundaryNorm(bounds, cmap.N)
data = np.array([[1,1,1,1,7,7,7,7], [1,1,1,1,1,1,1,5], [1,1,1,1,1,1,1,5], [1,1,1,3,1,1,1,5], [1,1,1,1,1,1,3,5]])
ax = sns.heatmap(data, cmap=cmap, norm=norm, linewidths=.5, linecolor='black', square=True, cbar=False)
sns.plt.annotate('S', (1.4, 3.4))
sns.plt.show()

圖片描述

拼未來 回答

for循環(huán)結(jié)束后,i=3;
obj在循環(huán)外(又是一個(gè)對象,會被引用。你不用對象就不會有問題)最后拿到的就都是i=3的時(shí)候的數(shù)據(jù)。
所以你需要把obj的聲明放循環(huán)里面,每次循環(huán)結(jié)束后,obj這個(gè)對象都會被重新構(gòu)造,不會出引用問題,賦值就OK了。

尐潴豬 回答

自 5.4 起可以使用短數(shù)組定義語法,用 [] 替代 array()。
PHP手冊-數(shù)組

心夠野 回答

你wait一會兒,有可能呢頁面還沒渲染好,或者你用until來判斷一下頁面是否加載完全,隨后你再去獲取頁面的html

互擼娃 回答

最下面哪一行{"msg"....}不是打印出來了嗎??
你想要返回什么東西?你覺得你過一段時(shí)間回來看這個(gè)問題你自己能看得懂在問什么嗎?

艷骨 回答

here
https://static.howbuy.com/??/upload/auto/script/fund/jzzs_001605.js,/upload/auto/script/fund/jjjl_001605.js,/upload/auto/script/fund/data_001605.js?v=7c097a5

離殤 回答

圖片描述

你怎么獲取的?我的是正常的啊

別傷我 回答

df.drop(df.index[1:][df.B[1:]<df.B[:-1]])


需要根據(jù)B列篩選,條件為目標(biāo)列的后值大于前值,把index=4的這行去掉。

@zoujj

>>> import pandas as pd
>>> df = pd.DataFrame(list(range(1,8)),columns=['B'])
>>> df.B[4]=3
>>> df['A']=1
>>> df
   B  A
0  1  1
1  2  1
2  3  1
3  4  1
4  3  1
5  6  1
6  7  1
>>> df[(df.B[1:]<df.B[:-1])] # @zoujj 的方法是錯(cuò)的
Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    df[(df.B[1:]<df.B[:-1])]
……
pandas.core.indexing.IndexingError: Unalignable boolean Series key provided
>>> df.drop(df.index[1:][df.B[1:]<df.B[:-1]])
   B  A
0  1  1
1  2  1
2  3  1
3  4  1
5  6  1
6  7  1
>>>