2017-10-19 1 views
0

Seaborn 라이브러리를 사용하여 FacetGrid에서 플롯하려는 다음 데이터 프레임이 있습니다.HTTP 오류 404 : 찾을 수 없음 Seaborn FacetGrid

projectId sentDate correspondenceId Year Month 
0  10417 2001-09-25    8710 2001  9 
1  10417 2001-10-01    9173 2001 10 
2  10417 2001-10-05    9676 2001 10 
3  10417 2001-10-24   11487 2001 10 
4  10417 2001-10-29   11872 2001 10 

나는

data_plot = sns.load_dataset("new_df") 
f = sns.FacetGrid(data_plot, col="Year", col_wrap=4, size=1.5) 
f = f.map(plt.plot, "Month", "correspondenceId.count()", marker=".") 

을 플롯하려면 다음 코드를 사용하고하지만

--> 650   raise HTTPError(req.full_url, code, msg, hdrs, fp) 
    651 
    652 class HTTPRedirectHandler(BaseHandler): 

HTTPError: HTTP Error 404: Not Found 

내 라이브러리가 최신 오류를 얻고있다. 나는 프로그래밍에 익숙하지 않아 올바른 출력을 얻기 위해 코딩하는 동안 많은 시행 착오를 반복한다. 이 아이디어를 해결하는 방법에 대한 아이디어가 있으십니까?.

답변

1

seaborn의 load_dataset 기능은 데이터 세트를 온라인으로 표시합니다. 문서화 문자열에서

는 모듈 seaborn.utils의 기능 load_dataset에

도움말 :

load_dataset (이름, 캐시 = 사실, data_home = 없음, ** KWS) 로드 온라인에서 데이터 집합 저장소 (인터넷 필요). 정의 된 온라인 저장소에서 이후

Parameters 
---------- 
name : str 
    Name of the dataset (`name`.csv on 
    https://github.com/mwaskom/seaborn-data). You can obtain list of 
    available datasets using :func:`get_dataset_names` 
cache : boolean, optional 
    If True, then cache data locally and use the cache on subsequent calls 
data_home : string, optional 
    The directory in which to cache data. By default, uses ~/seaborn-data/ 
kws : dict, optional 
    Passed to pandas.read_csv 

는 404 오류를 반환 더 new_df 파일이 없습니다.

seaborn 함수에 데이터 프레임을 전달할 수 있습니다 (코드에서 이미 정의 된 경우).

df가 new_df 인 경우

f = sns.FacetGrid(new_df, col="Year", col_wrap=4, size=1.5) 

데이터 프레임을 사용해야합니다.

+0

이 문제가 해결되었습니다. 고맙습니다! – snakepain

관련 문제