我可以使用以下命令运行正常的redis泊坞窗图像。
import pandas as pd
clns = [
'Company','Title','Location','Dates',
'Company2','Title2','Location2','Dates2',
]
df = pd.DataFrame(columns = clns)
row = [
'CVS, Richardson--company name', 'Java Developer--title',
'-Not Provided--location', 'August 2017 to December 2017--dates',
'StrikeTru--company name', 'Java Developer--title',
'Hyderabad, Telangana--location', 'May 2012 to July 2015--dates',
]
# Works fine! Length of `row` matches length of `df.columns`
df.loc[0] = row
# Accidentally cause a column to be created by indexing a non-existent column.
# Note that 'New Column' doesn't have to be a string, it could be a number as well.
df.loc[(0, 'New Column')] = None
# Indexing 'New Column' automatically created it
print(df.columns)
# Index(['Company', 'Title', 'Location', 'Dates', 'Company2', 'Title2',
# 'Location2', 'Dates2', 'New Column'],
# dtype='object')
# Setting a row now fails with
df.loc[1] = row
# ValueError: cannot set a row with mismatched columns
然后我可以通过redis-py访问数据库。 但我想使用自定义配置文件,为了做到这一点,我指定了我的redis.conf的路径并创建了这样的容器:
docker run --name redis -p 6379:6379 -v /home/maryam/redis:/data -d redis redis-server
容器构建没有任何错误,我可以在其中看到redis.conf文件。问题是当我想通过redis-py对数据库做任何事情时,我收到以下错误:
docker run -v /home/maryam/Desktop/redis.conf:/usr/local/etc/redis/redis.conf -v /home/maryam/redis:/data -p 6379:6379 --name redis -d redis redis-server /usr/local/etc/redis/redis.conf
我认为问题的根源应该是我编辑过的redis.conf文件并将这些行添加到其中:
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
没有它,它完美无缺! 所以任何想法我怎么能克服这个?