python - Python-Django 导入 csv 到 Jupiter 注意本地
问题描述
嗨,我在 Django 应用程序中创建导出 csv 文件,接下来我将其导入 Jupiter,当我的 Django 在线发布时一切正常,但是当我的项目在本地运行时无法导入,如http://127.0.0.1:8000/
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import io
import requests
import urllib.request as urllib2
df = pd.read_csv('http://127.0.0.1:8000/covid/covid.csv/')
df.head(100)
ConnectionRefusedError Traceback (most recent call last)
/usr/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1349 h.request(req.get_method(), req.selector, req.data, headers,
-> 1350 encode_chunked=req.has_header('Transfer-encoding'))
1351 except OSError as err: # timeout error
18 frames
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
/usr/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1350 encode_chunked=req.has_header('Transfer-encoding'))
1351 except OSError as err: # timeout error
-> 1352 raise URLError(err)
1353 r = h.getresponse()
1354 except:
URLError: <urlopen error [Errno 111] Connection refused>
有任何想法吗?
解决方案
推荐阅读
- django - 如何在 django 中使用引导模式?
- facebook - 从 Facebook Graph API Rating 调用中获取 Reviewer 信息
- xamarin - 在 Prism 7 中注册和解析 DI 容器 - Xamarin Forms
- javascript - 模拟 _gaq_push 函数的函数
- java - 为 spring-cloud-bus 设置 zookeeper 主机和端口
- android - ffmpeg 混合过滤器无法正常工作
- angular - RXJS:合并流并利用最新的流
- javascript - Firebase 数据库规则,获取数据的问题
- php - 如何从 RedirectResponse 对象强制 Laravel 5.6 重定向?
- c++ - 计算文本大小