我有以下散点图代码
dimens = (12, 10)
fig, ax = plt.subplots(figsize=dimens)
sns.scatterplot(data = information, x = 'latitude', y = 'longitude', hue="genre", s=200,
x_jitter=4, y_jitter=4, ax=ax)
Run Code Online (Sandbox Code Playgroud)
无论我将抖动更改为什么,绘图仍然非常接近。它出什么问题了?
示例数据框:
store longitude latitude genre
mcdonalds 140.232323 40.434343 all
kfc 140.232323 40.434343 chicken
burgerking 138.434343 35.545433 burger
fiveguys 137.323984 36.543322 burger
Run Code Online (Sandbox Code Playgroud) 我正在尝试将 csv 文件作为数据框导入 Jupyter 笔记本中。
rest_relation = pd.read_csv('store_id_relation.csv', delimiter=',')
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误
FileNotFoundError: [Errno 2] No such file or directory: 'store_id_relation.csv'
Run Code Online (Sandbox Code Playgroud)
store_id_relation.csv 肯定位于数据文件夹中,我尝试将 data\ 添加到文件位置,但出现相同的错误。这里出了什么问题?
如果我有以下数据框“国家”:
country info
england london-europe
scotland edinburgh-europe
china beijing-asia
unitedstates washington-north_america
Run Code Online (Sandbox Code Playgroud)
我想获取信息字段,并且必须删除“-”之后的所有内容,变为:
country info
england london
scotland edinburgh
china beijing
unitedstates washington
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?