小编cca*_*444的帖子

在Dockerfile中安装熊猫

我正在尝试创建Docker映像。Dockerfile如下:

# Use the official Python 3.6.5 image
FROM python:3.6.5-alpine3.7

# Set the working directory to /app
WORKDIR /app

# Get the 
COPY requirements.txt /app
RUN pip3 install --no-cache-dir -r requirements.txt

# Configuring access to Jupyter
RUN mkdir /notebooks
RUN jupyter notebook --no-browser --ip 0.0.0.0 --port 8888 /notebooks
Run Code Online (Sandbox Code Playgroud)

requirements.txt文件为:

jupyter
numpy==1.14.3
pandas==0.23.0rc2
scipy==1.0.1
scikit-learn==0.19.1
pillow==5.1.1
matplotlib==2.2.2
seaborn==0.8.1
Run Code Online (Sandbox Code Playgroud)

docker build -t standard .当docker尝试安装熊猫时,运行命令给我一个错误。错误如下:

Collecting pandas==0.23.0rc2 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/46/5c/a883712dad8484ef907a2f42992b122acf2bcecbb5c2aa751d1033908502/pandas-0.23.0rc2.tar.gz (12.5MB)
    Complete output from command python setup.py egg_info: …
Run Code Online (Sandbox Code Playgroud)

python pandas docker dockerfile python-3.6

9
推荐指数
3
解决办法
4239
查看次数

函数后的括号是什么意思

有人问我在Python 3编写一个函数为:写一个调用的函数general_poly,这将,例如,评估general_poly([1, 2, 3, 4])(10)12341*10^3 + 2*10^2 + 3*10^1 + 4*10^0.

现在我不明白第二个括号是什么(10)意思.

我的功能如何general_poly知道,将这个值放在自身内部并使用它?

python function python-3.x

6
推荐指数
1
解决办法
131
查看次数

BingAds客户端状态,oauth_web_auth_code_grant

我想通过bingads API从我的BingAds中获取我的自定义"报告"数据.我正在使用这个KeywordsAds.py可能不正确的例子.但是,我的问题始于身份验证,我似乎无法找到所需的所有身份验证输入.我错过了类似的例子,所以我知道我是否插入了正确的数据:

authorization_data=AuthorizationData(
    account_id='123456789', --instead of just None
    customer_id='123456789', --instead of just None
    developer_token='12345A1234567891', --instead of just DeveloperTokenGoesHere
    authentication='OAuthWebAuthCodeGrant', --instead of just None
Run Code Online (Sandbox Code Playgroud)

)

1)对于上面的代码,authentication我需要为WebAPI选择什么?(2)对于我所说的问题,我是否需要使用WebAPI,或者Web平台是否更有用?

CLIENT_ID='ClientIdGoesHere'
CLIENT_STATE='ClientStateGoesHere'
Run Code Online (Sandbox Code Playgroud)

3)什么是Client_State?我这个词确实谷歌,但没有找到解释.可以/需要插入什么值?

最后,我没有在示例代码中找到client_secret和redirection_uri,但它在Bing的Python入门页面上有说明:

oauth_web_auth_code_grant = OAuthWebAuthCodeGrant(
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
    redirection_uri=REDIRECTION_URI
Run Code Online (Sandbox Code Playgroud)

这有必要填写吗?

bing-api python-3.x

5
推荐指数
1
解决办法
709
查看次数

每年分割时间序列以进行绘图

我想绘制一个时间序列,从 2015 年 10 月开始,到 2018 年 2 月结束,在一张图中,每年都是一条线。时间序列是int64值并且位于Pandas DataFrame. 日期作为datetime64[ns]DataFrame 中的列之一。

我如何从 Jan-Dez 创建一个每年有 4 条线的图表。

使用 graph['share_price'] 和 graph['date']。我已经尝试过Grouper,但这不知何故采用了 2015 年 10 月的值并将其与所有其他年份的 1 月值混合。

这个 groupby 接近我想要的,但是我丢失了列表索引属于哪一年的信息。

graph.groupby('date').agg({'share_price':lambda x: list(x)})
Run Code Online (Sandbox Code Playgroud)

然后我创建了一个包含 4 列的 DataFrame,每年 1 列,但我仍然不知道如何继续以某种方式对这 4 列进行分组,以便我能够以我想要的方式绘制图表。

time-series python-3.x pandas

0
推荐指数
1
解决办法
2676
查看次数