嗨,我是python和pandas的新手。
我已经使用pandas提取了其中一列的唯一值。现在,在获取列的唯一值(即字符串)之后。
['Others, Senior Management-Finance, Senior Management-Sales'
'Consulting, Strategic planning, Senior Management-Finance'
'Client Servicing, Quality Control - Product/ Process, Strategic
planning'
'Administration/ Facilities, Business Analytics, Client Servicing'
'Sales & Marketing, Sales/ Business Development/ Account Management,
Sales Support']
Run Code Online (Sandbox Code Playgroud)
我想用唯一的整数值替换字符串值。
为简单起见,我可以为您提供虚拟输入和输出。
输入:
Col1
A
A
B
B
B
C
C
Run Code Online (Sandbox Code Playgroud)
唯一的df值如下
[ 'A' 'B' 'C' ]
Run Code Online (Sandbox Code Playgroud)
更换色谱柱后应如下所示
Col1
1
1
2
2
2
3
3
Run Code Online (Sandbox Code Playgroud)
请给我建议使用循环或其他任何方式的方法,因为我拥有的不仅是300唯一值。
我是scrapy的新手,我让scrapy项目废弃了数据.
我正在尝试从网站上搜索数据,但我收到了错误日志
2016-08-29 14:07:57 [scrapy] INFO: Enabled item pipelines:
[]
2016-08-29 13:55:03 [scrapy] INFO: Spider opened
2016-08-29 13:55:03 [scrapy] INFO: Crawled 0 pages (at 0 pages/min),scraped 0 items (at 0 items/min)
2016-08-29 13:55:04 [scrapy] DEBUG: Crawled (403) <GET http://www.justdial.com/robots.txt> (referer: None)
2016-08-29 13:55:04 [scrapy] DEBUG: Crawled (403) <GET http://www.justdial.com/Mumbai/small-business> (referer: None)
2016-08-29 13:55:04 [scrapy] DEBUG: Ignoring response <403 http://www.justdial.com/Mumbai/small-business>: HTTP status code is not handled or not allowed
2016-08-29 13:55:04 [scrapy] INFO: Closing spider (finished)
Run Code Online (Sandbox Code Playgroud)
我正在尝试按照命令然后在网站控制台然后我得到了响应,但当我在python脚本中使用相同的路径时,我得到了我上面描述的错误.
Web控制台上的命令:
$x('//div[@class="col-sm-5 col-xs-8 store-details …Run Code Online (Sandbox Code Playgroud) 我是谷歌云的新手,我正在尝试在我的谷歌云实例上安装 scipy。
当我在 google cloud shell 上执行以下命令以安装 scipy 但安装过程已被终止时。
安装命令
pip install scipy
Run Code Online (Sandbox Code Playgroud)
在安装过程中,我收到以下消息。
Collecting scipy
Downloading scipy-0.19.0-cp27-cp27mu-manylinux1_x86_64.whl (45.0MB)
99% |????????????????????????????????| 45.0MB 46.8MB/s eta 0:00:01Killed
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。谢谢。
pip scipy python-2.7 google-compute-engine google-cloud-platform
python-2.7 ×2
categories ×1
dataframe ×1
pandas ×1
pip ×1
python ×1
replace ×1
scipy ×1
scrapy ×1