小编Yog*_*dav的帖子

多个ssh密钥不起作用

OS Description: Ubuntu 14.04.3 LTS
ssh: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3, OpenSSL 1.0.1f 6 Jan 2014
Run Code Online (Sandbox Code Playgroud)

我无法为gitlab使用多个ssh密钥.我得到的错误是

GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists. 
Run Code Online (Sandbox Code Playgroud)

我非常确定我做的一切都是正确的这是我的配置文件

Host work gitlab.com
    Hostname gitlab.com
    IdentityFile ~/.ssh/ida_rsa
    User git

Host integrate gitlab.com
    Hostname gitlab.com
    IdentityFile ~/.ssh/ida_rsa_personal
    User git
Run Code Online (Sandbox Code Playgroud)

密钥在ssh-agent中自动添加,但为了确保我还手动添加了密钥

$ ssh-add -l
2048 e7:08:d6:8c:00:28:31:f9:3f:21:4a:0f:4e:1e:ee:20 id_rsa (RSA)
2048 ff:22:f6:90:2b:7c:9f:ed:45:41:df:79:06:de:fe:81 id_rsa_personal (RSA)
Run Code Online (Sandbox Code Playgroud)

我的ssh-agent也在运行

$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-uTC6tA5HMt1x/agent.4899; …
Run Code Online (Sandbox Code Playgroud)

git ssh openssh ssh-agent gitlab

9
推荐指数
1
解决办法
9989
查看次数

将ignore pandas dataframe插入mysql

我想将整个pandas数据帧"插入忽略"到mysql中.有没有办法在没有循环行的情况下执行此操作?

在dataframe.to_sql中,我只看到if_exists'append'选项,但是这仍然会在重复的唯一键上继续吗?

python mysql pandas pandas-to-sql

5
推荐指数
2
解决办法
2337
查看次数

用pandas DataFrame替换mysql数据库表中的行

Python版本 - 2.7.6

熊猫版 - 0.17.1

MySQLdb版本 - 1.2.5

在我的数据库(PRODUCT)中,我有一个表(XML_FEED).表XML_FEED很大(百万记录)我有一个pandas.DataFrame()(PROCESSED_DF).数据框有数千行.

现在我需要运行它

REPLACE INTO TABLE PRODUCT.XML_FEED
(COL1, COL2, COL3, COL4, COL5),
VALUES (PROCESSED_DF.values)
Run Code Online (Sandbox Code Playgroud)

题:-

有没有办法REPLACE INTO TABLE在熊猫中跑?我已经检查过,pandas.DataFrame.to_sql()但这不是我需要的.我不喜欢XML_FEED在大熊猫中读表,因为它非常庞大.

python mysql replace pandas

5
推荐指数
2
解决办法
4503
查看次数

Pandas DataFrame.to_sql()错误-字符串格式化期间未转换所有参数

Python版本-2.7.6

熊猫版-0.17.1

MySQLdb版本-1.2.5

DataFrame.to_sql()pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': not all arguments converted during string formatting

Python代码段

con = MySQLdb.connect('localhost', 'root', '', 'product_feed')
cur = con.cursor()
cur.execute("SELECT VERSION()")
connection_result = cur.fetchall()
print connection_result[0][0]     #It prints 5.5.44-0ubuntu0.14.04.1

table_column = ['A', 'B', 'C']
created_data = numpy.array([numpy.arange(10)]*3).T
df = pandas.DataFrame(data=created_data ,columns=table_column)
df.to_sql('test_table', con)
Run Code Online (Sandbox Code Playgroud)

该错误来自df.to_sql('test_table', con)行的执行。

错误详情

  File "/home/yogi/yogi/mlPython/product_feed/etl_pf/process_data.py", line 298, in render_df
    df.to_sql('test_table', con)
  File "/home/yogi/yogi/mlenv/local/lib/python2.7/site-packages/pandas/core/generic.py", line 1003, in to_sql
    dtype=dtype)
  File …
Run Code Online (Sandbox Code Playgroud)

python sql formatting mysql-python pandas

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

使用机器学习算法仅根据内容而不是用户历史来查找类似产品的正确方法

我有大约 2-3 百万种产品。每个产品都遵循这个结构

{
    "sku": "Unique ID of Product ( String of 20 chars )"
    "title":"Title of product eg Oneplus 5 - 6GB + 64GB ",
    "brand":"Brand of product eg OnePlus",
    "cat1":"First Category of Product Phone",
    "cat2":"Second Category of Product Mobile Phones",
    "cat3":"Third Category of Product Smart Phones",
    "price":500.00,
    "shortDescription":"Short description about the product ( Around 8 - 10 Lines )",
    "longDescription":"Long description about the product ( Aroung 50 - 60 Lines )"
}
Run Code Online (Sandbox Code Playgroud)

问题陈述是

仅根据内容或产品数据查找类似产品。所以当电子商务用户点击一个产品(SKU)时,我会在推荐中展示与该SKU或产品相似的产品。

比如用户点击apple iphone 6s …

machine-learning similarity tf-idf svd predictionio

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

python dict,list对所有类都有相同的实例

我从最近3个月开始研究python 2.7,今天注意到这一点后我感到非常惊讶.

对于以下代码段

class Example:
    children = {}

instance1 = Example()
instance1.children['instance1_child1'] = 'Instance 1 child 1'

instance2 = Example()
instance2.children['instance2_child1'] = 'Instance 2 child 1'
for key, value in instance2.children.items():
    print key + ' -> ' + value
Run Code Online (Sandbox Code Playgroud)

为什么输出

instance1_child1 -> Instance 1 child 1
instance2_child1 -> Instance 2 child 1
Run Code Online (Sandbox Code Playgroud)

对于我正在创建的所有对象,似乎只有一个dict()实例.我也检查了list [],他们的行为也是一样的.

我无法理解python的这种行为以及它背后的逻辑.这是某种设计缺陷还是我做错了什么并且应该退出编程?

python dictionary class list instance

2
推荐指数
1
解决办法
380
查看次数