반응형
babyhack@ubuntu:~/tmp$ sudo pip3 install pip --upgrade
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 11, in main
    from pip._internal.utils.entrypoints import _wrapper
  File "/usr/local/lib/python3.5/dist-packages/pip/_internal/utils/entrypoints.py", line 12
    f"pip{sys.version_info.major}",
                                 ^
SyntaxError: invalid syntax
babyhack@ubuntu:~/tmp$ wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
--2023-02-10 00:21:55--  https://bootstrap.pypa.io/pip/3.5/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ...
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... connected.
HTTP request sent, awaiting response...
200 OK
Length: 1908223 (1.8M) [text/x-python]
Saving to: ‘get-pip.py’

get-pip.py                           100%[===================================================================>]   1.82M  6.01MB/s    in 0.3s

2023-02-10 00:21:55 (6.01 MB/s) - ‘get-pip.py’ saved [1908223/1908223]

babyhack@ubuntu:~/tmp$ python3 get-pip.py
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 7.7 MB/s
Installing collected packages: pip
Successfully installed pip-20.3.4
babyhack@ubuntu:~/tmp$ sudo pip3 install pip --upgrade
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
WARNING: The directory '/home/babyhack/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pip in /home/babyhack/.local/lib/python3.5/site-packages (20.3.4)
Collecting pip
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 5.8 MB/s
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 9.4 MB/s
babyhack@ubuntu:~/tmp$

 

명령어

반응형

'프로그래밍 > Python' 카테고리의 다른 글

[codegate2016] compress 복호화  (0) 2016.03.16
File Fuzzer v.0.1  (2) 2013.08.11
danger_track를 이용한 crash dump 활용  (0) 2013.07.30
win7 에서 pydbg 이용한 snap 찍기  (0) 2013.07.29
Windows 7에서 pydbg 설치 하기  (0) 2013.07.26
반응형


1. Threshold 간단하게 표현 하자.



많은 데이터 중에서 특정 값 이상인 데이터 수를 확인 하기 위해서는 다음과 같이 interact 라이브러리를 활용하여

threshold bar로 표현 할 수 있다.



from ipywidgets import interact


@interact

def show_nrows(distance_threshold=(0, 200)):

    return len(data.loc[data.trip_distance > distance_threshold]) 




위 그림과 같이 69보다 큰 데이터가 11개 존재하는 것을 interact 라이브러리로 표현 할 수 있다.


2. Anaconda Package 설치 하기



conda install [package name] -q -y 


[실행결과]


C:\Users\crattack>conda install seaborn -q -y

Using Anaconda Cloud api site https://api.anaconda.org

Fetching package metadata: ....

Solving package specifications: .........


Package plan for installation in environment C:\Anaconda2:


The following packages will be downloaded:


    package                    |            build

    ---------------------------|-----------------

    conda-env-2.6.0            |                0          498 B

    python-2.7.12              |                0        23.5 MB

    ruamel_yaml-0.11.14        |           py27_0         212 KB

    conda-4.2.12               |           py27_0         454 KB

    seaborn-0.7.1              |           py27_0         272 KB

    ------------------------------------------------------------

                                           Total:        24.4 MB


The following NEW packages will be INSTALLED:


    ruamel_yaml: 0.11.14-py27_0

    seaborn:     0.7.1-py27_0


The following packages will be UPDATED:


    conda:       4.0.5-py27_0 --> 4.2.12-py27_0

    conda-env:   2.4.5-py27_0 --> 2.6.0-0

    python:      2.7.11-4     --> 2.7.12-0 




반응형
반응형



데이터 분석을 시작하여 분석을 시작했다면 이젠 Hadoop을 사용하는 방법을 알아야 한다.

아직 데이터를 가져오는 것은 무리가 되겠지만 Hadoop에 접근 가능한 권한을 얻었다면 테스트로 붙어봐야한다.


그럼 테스트로 붙는 방법은 어떻게 해야 할까?

테스트를 하기 위해서 테스트 코드를 작성해도 무관하지만 web 으로 충분히 테스트 가능하다.


우선 Hadoop에서 사용하는 테스트 포트를 확인 해야 한다.


http://blog.cloudera.com/blog/2009/08/hadoop-default-ports-quick-reference/



DaemonDefault PortConfiguration Parameter
HDFSNamenode

50070

dfs.http.address
Datanodes

50075

dfs.datanode.http.address
Secondarynamenode

50090

dfs.secondary.http.address
Backup/Checkpoint node?

50105

dfs.backup.http.address
MRJobracker

50030

mapred.job.tracker.http.address
Tasktrackers

50060

mapred.task.tracker.http.address
? Replaces secondarynamenode in 0.21.


위 Port를 기반으로 접근 테스트를 진행 하면 된다.


http://localhost:50070


위 사이트에 접근이 가능하다면 접근 테스트는 정상적이므로 이젠 코딩을 진행 하면 되겠다.


to be continue........

반응형
반응형

import pandas as pd 

※ pandas를 활용하면 DataFrame의 객체로 생성 해 줍니다.

 

함수 

설명 

read_csv

구분자 ","의 데이터를 읽어 올 때 사용

read_table 

구분자 "\t"의 데이터 읽어 올 때 사용

read_fwf 

구분자 없는 데이터를 읽어 올 때 사용 

read_clipboard 

클립보드에 있는 데이터를 읽어 오고, read_table로 표시 

 

 

[[ index col 지정 - 적용 전 ]]

parsed_org = pd.read_csv('ch06/csv_mindex.csv')
parsed_org 

 


 

[[ index col 지정 - 적용 후 ]]

parsed = pd.read_csv('ch06/csv_mindex.csv', index_col=['key1', 'key2'])
parsed




[[ 공백으로 데이터 정제 ]]

result = pd.read_table('ch06/ex3.txt', sep='\s+') # 공백으로 구분

result 

 



[[ 행 선택적으로 데이터 정제 - 적용 전 ]]

pd.read_csv('ch06/ex4.csv') 




[[ 행 선택적으로 데이터 정제 - 적용 ]]

pd.read_csv('ch06/ex4.csv', skiprows=[0, 2, 3]) #0, 2, 3 행만 출력




[[ 컬럼 명 지정 - 적용 전 ]]

pd.read_csv('ch06/ex2.csv', header=None) 



[[ 컬럼 명 지정 - 적용 후 ]]

pd.read_csv('ch06/ex2.csv', header=None) 



[[ 문자열 치환 - 적용 전 ]]

result = pd.read_csv('ch06/ex5.csv', na_values=['NULL'])



[[ 문자열 치환 - 적용 ]]

sentinels = {'message':['foo', 'NA'], 'something':['two']}

pd.read_csv('ch06/ex5.csv', na_values = sentinels)



[[ 파일 저장 - DataFrame 활용 ]]

data = pd.read_csv('ch06/ex5.csv')

data.to_csv('out.csv')

pd.read_csv('out.csv')



[[ 파일 저장 - sys 라이브러리 활용 ]]

import sys

data.to_csv(sys.stdout, sep='|') 

 

 


 

[[ 결과 ]]

|something|a|b|c|d|message
0|one|1|2|3.0|4|
1|two|5|6||8|world
2|three|9|10|11.0|12|foo

 


[[ 파일 저장 - 컬럼 선택적 저장 ]]

import sys

data.to_csv(sys.stdout, index=False, cols['a', 'b', 'c']) 

 

 

[[ 결과 ]]

a,b,c
1,2,3.0
5,6,
9,10,11.0

반응형
반응형

출처 : http://shaeod.tistory.com/562

정규표현식 테스트 : http://www.regexr.com/

 

기본 메타 문자

 .

 점 하나당 하나의 문자에 해당하며 모든 문자와 일치

 |

 왼쪽 혹은 오른쪽과 일치

 []

 문자 집합 구성원 중 하나와 일치

 [^]

 문자 집합 구성원을 제외하고 일치

 -

 범위 정의 ([A-Z]와 같은 형태)

 \

 다음에 오는 문자를 이스케이프

수량자

 *

 문자가 없는 경우나 하나 이상 연속하는 문자 찾기

 *?

 게으른 * 문자

 +

 문자 하나 이상 찾기

 +?

 게으른 + 문자

 ?

 문자가 없거나 하나인 문자 찾기

 {n}

 정확히 요소와 n번 일치

 {m,n}

 요소와 m에서 n번 일치

 {n,}

 요소와 n번 이상 일치

 {n,}?

 게으른 {n,}

위치 지정

 ^

 문자열의 시작과 일치

 \A

 문자열의 시작과 일치

 $

 문자열의 끝과 일치

 \Z

 문자열의 끝과 일치

 \<

 단어의 시작과 일치

 \>

 단어의 끝과 일치

 \b

 단어 경계와 일치

 \B

 \b와 반대로 일치

단축 문자

(특수한 문자)

 [\b]

 역스페이스

 \c

 제어문자와 일치

 \d

 모든 숫자와 일치

 \D

 \d와 반대

 \f

 페이지 넘기기(form feed)

 \n

 줄바꿈

 \r

 캐리지 리턴

 \s

 공백 문자와 일치

 \S

 \s와 반대로 일치

 \t

 탭

 \v

 수직 탭

 \w

 영숫자 문자나 밑줄과 일치

 \W

 \w와 반대로 일치

 \x

 16진수 숫자와 일치

 \O

 8진수 숫자와 일치

역참조와 전후방 탐색

 ()

 하위 표현식 정의

 \1

 첫 번째 일치한 하위 표현식. 두 번째 일치한 하위 표현식은 \2로 표기

 ?=

 전방 탐색

 ?<=

 후방 탐색

 ?!

 부정형 전방 탐색

 ?<!

 부정형 후방 탐색

 ?(backreference)true

 조건 지정

 ?(backreference)true|false

 else 표현식 조건 지정

대소문자 변환

 \E

 \L 혹은 \U 변환을 끝냄

 \l

 다음에 오는 글자를 소문자로 변환

 \L

 \E를 만날 때까지 모든 문자를 소문자로 변환

 \u

 다음에 오는 글나를 대문자로 변환

 \U

 \E를 만날 때까지 모든 문자를 대문자로 변환

POSIX 문자 클래스

 [:alnum:]

 모든 영숫자 ([a-zA-Z0-9]와 같음)

 [:alpha:]

 모든 영문자 ([a-zA-Z]와 같음)

 [:blank:]

 빈칸(space)이나 탭 문자 ([\t]와 같음)

 [:cntrl:]

 아스키 제어문자(아스키 0번부터 31, 127)

 [:digit:]

 모든 한 자리 숫자 ([0-9]와 같음)

 [:graph:]

 [:print:]와 동일하나 빈칸(space)은 제외

 [:lower:]

 모든 소문자 ([a-z]와 같음)

 [:print:]

 출력 가능한 모든 문자

 [:punct:]

 [:alnum:]이나 [:cntrl:]가 포함되지 않은 모든 문자

 [:space:]

 빈칸을 포함한 모든 공백 문자 ([\f\n\r\t\v]와 같음)

 [:upper:]

 모든 대문자 ([A-Z]와 같음)

 [:xdigit:]

 모든 16진수 숫자 ([a-fA-F0-9]와 같음)

변경자

 (?m)

 다중행 모드

반응형
반응형

[[ 특정 값 추출 ]]

 

UserInfo 테이블의 "106.187.44.5"에 해당 하는 유저를 추출하여 ExtratorIP 테이블에 저장합니다.

DataFrame()를 통하여 테이블을 정리합니다.

 

ExtractionIP = UserInfo[UserInfo.client_ip == 127.0.0.1']
ExtractionIP = DataFrame(ExtractorIP)
ExtractionIP.Info()

 

[[출력]]

<class 'pandas.core.frame.DataFrame'> Int64Index: 15 entries, 13250 to 95289 Data columns (total 20 columns): date 15 non-null object ip 15 non-null object id 15 non-null object status1 15 non-null object status2 15 non-null int64 status3 15 non-null object

............

 

ExtractionIP

 

 

[[ 특정 컬럼 추출 ]]

 

groupby 객체를 활용하여 원하는 내용을 추출 할 수 있습니다.

다양한 컬럼이 존재 할때 "ip, id, status1, status2, data"를 추출하고 싶다면 다음을 코드를 활용합니다.

 

extraction_info = ExtractionIP.groupby(['ip', 'id', 'status1', 'status2', 'status3', 'data'])

extraction_info.mean()

 

 

 

[[ 특정 컬럼 / 테이블 파일로 저장]

 

추출한 컬럼 및 테이블을 저장하기 위해서는 Numpy 패키지를 활용하면 됩니다.

(※ 파일은 raw file로 저장됩니다.)

 

import numpy as np

 

np.save('Extraction_raw_data', extraction_info)

 

반응형
반응형

비율을 사용할 경우 전체의 합이 1이 되는지를 확인 하는 방법이 Sanity Check 입니다.

만약, 1보다 작거나, 크다면 잘못된 계산이므로 반드시 체크 하는 것이 좋습니다.

 

Sanity Check할 때 사용하는 라이브러리는 numpy 입니다. 따라서, 우선 numpy를 Load 한 후 사용 해야 합니다.

 

import numpy as np

np.allclose(names.groupby(['year', 'sex']).prop.sum(), 1) 

 

위 코드가 실행 된 이후 "True" 가 표시 되면 잘 처리된 결과 이지만 "False"가 출력 되면 잘못 된 경우이니 꼭 체크하고 넘어가야 합니다.

 

항목 별 카운트 확인 하기 위해서는 TABLE.value_counts()를 활용하면 됩니다.

 

# 라이브러리 선언

%matplotlib inline
from pandas import DataFrame
import pandas as pd
import numpy as np

# 파일 로딩 및 테이블 생성

UserInfo = pd.read_csv('testcase.txt', sep='\t', names=['date', 'ip', 'account', 'money', 'id'])
DF_UserInfo = DataFrame(UserInfo)

ip_count = DF_UserInfo['ip'].value_counts()   <--- 중복된 IP 카운트 저장

 

# 분류한 데이터 출력

ip_count

 

[ 출력 ]

127.0.0.1 499 127.0.0.2 114 127.0.0.3 86

 

컬럼에 존재하는 특정 값의 카운트를 확인하는 자체 함수 입니다.

 

def get_counts(seq):
    counts = {}
    for x in seq:
        if x in counts:
            counts[x] += 1
        else:
            counts[x] = 1
    return counts

 

counts = get_counts(UserInfo['ip']) 

counts['106.187.44.5']

 

 

 

 

 

반응형
반응형

 

"mean_ratings" 라는 테이블이 존재한다고 할때, Column을 생성하는 방법은 다음과 같습니다.

 

mean_ratings['diff'] = mean_ratings['M'] - mean_ratings['F']

 

// mean_ratings 테이블에 "M"의 값을 "F"로 뺀 차이를 "diff" 라는 컬럼에 저장하는 명령어 입니다.

// diff가 양수 : M(남성)이 더 높은 점수를 준 타이틀입니다. / 음수 : F(여성)이 더 높은 점수를 준 타이틀 입니다.

 

"diff" 라는 Column이 추가됩니다.

사용하고 싶다면 다음과 같이 활용할 수 있습니다.

 

 mean_ratings.sort_values(by='diff')

 

정렬은 다음과 같이 확인 할 수 있습니다.

 

sorted_by_[Column][::-1][:15] 

ex) sorted_by_diff[::-1][:15]

 

이제 컬럼을 사용하는 방법을 알았으니, 표준편차를 구하는 것을 알아보도록 하겠습니다.

※ 표준편차 : 평균과 얼마나 가까이 있는가를 계산하는 방법 (상세설명)

 

[New Column Name] = data.groupby('Column Name')['Column Name'].std()

ex) rating_std_by_title = data.groupby('title')['rating'].std()

 

여러 파일이 존재할 경우 한번에 읽기 위해서는 다음과 같은 코드를 사용하면 됩니다.

pandas.concat 메소드를 활용하면 합칠 수 있습니다.

 

import pandas as pd

 

#파일명

years = range(1880, 2011)

pieces = []

 

# ex) alrex, M, 2004

columns = ['name', 'sex', 'births']

 

# 파일명 변경하면서 파일 읽기

for year in years: 

   path = '/names/yob%d.txt' % year

   frame = pd.read_csv(path, names = columns)

 

   frame['year'] = year

   pieces.append(frame)

 

# 모두 하나의 DataFrame으로 취합

names = pd.concat(pieces, ignore_index=True)

 

 

반응형
반응형

 

csv 포멧의 파일을 Parsing 하는 과정에서 다음과 같은 코드를 실행 할 경우 문제가 발생합니다.

 

import pandas as pd
import os
encoding = 'latin1'

mpath = os.path.expanduser('movielens/movies.dat')
rpath = os.path.expanduser('movielens/ratings.dat')
upath = os.path.expanduser('movielens/users.dat')

unames = ['user_id', 'gender', 'age', 'occupation', 'zip']
rnames = ['user_id', 'movie_id', 'rating', 'timestamp']
mnames = ['movie_id', 'title', 'genres']

users = pd.read_csv(upath, sep='::', header=None, names=unames, encoding=encoding)
ratings = pd.read_csv(rpath, sep='::', header=None, names=rnames, encoding=encoding)
movies = pd.read_csv(mpath, sep='::', header=None, names=mnames, encoding=encoding) 

 

[Error]

C:\Python27\lib\site-packages\ipykernel\__main__.py:13: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.
C:\Python27\lib\site-packages\ipykernel\__main__.py:14: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.
C:\Python27\lib\site-packages\ipykernel\__main__.py:15: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.

 

이럴 경우 engine='python'을 추가해주면 오류가 발생하지 않습니다.

 

import pandas as pd
import os
encoding = 'latin1'

mpath = os.path.expanduser('movielens/movies.dat')
rpath = os.path.expanduser('movielens/ratings.dat')
upath = os.path.expanduser('movielens/users.dat')

unames = ['user_id', 'gender', 'age', 'occupation', 'zip']
rnames = ['user_id', 'movie_id', 'rating', 'timestamp']
mnames = ['movie_id', 'title', 'genres']

users = pd.read_csv(upath, sep='::', header=None, names=unames, encoding=encoding, engine='python')
ratings = pd.read_csv(rpath, sep='::', header=None, names=rnames, encoding=encoding, engine='python')
movies = pd.read_csv(mpath, sep='::', header=None, names=mnames, encoding=encoding, engine='python')

 

데이터 파일이 여러개일 경우 다음과 같이 pandas의 merge함수를 활용하면 손쉽게 합칠 수 있습니다.

아래의 merge는 ratings 파일과 users 파일을 합치고 movies 파일을 합치는 과정을 나타내는 명령어 입니다.

(※ pd = import pandas as pd)

 

 data = pd.merge(pd.merge(ratings, users), movies)

 

테이블로 만들어진 Data는 .ix 메소드를 활용하여 컬럼을 사용할 수 있다.

 

data.ix[0] - index 0 컬럼의 데이터를 출력

 

 

반응형
반응형

 

IPython을 사용하다보면 %matplotlib inline을 사용 해야 하는 상황이 발생합니다.

도형이나 그래프로 output을 출력 하는 라이브러리 이므로 Qtconsole 환경이 필요합니다.

 

그럴 때, IPython qtconsole을 실행 하면 다음과 같은 에러가 발생할 수도 있습니다.

이럴 경우 에러 코드의 마지막을 보면 다음과 같이 필요한 라이브러리가 있습니다.

해당 라이브러리를 설치해주시면 문제 없이 실행 됩니다.

 

 

[에러코드]

 

[TerminalIPythonApp] WARNING | Subcommand `ipython qtconsole` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter qtconsole` in the  future
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\qtconsole\qtconsoleapp.py", line 49, in gui_excepthook
    old_excepthook(exctype, value, tb)
TypeError: 'NoneType' object is not callable
 .........................

    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

    Currently-imported Qt library:   None
    PyQt4 installed:                 False
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    Tried to load:                   ['pyqt5', 'pyside', 'pyqt']

 

pip install PySide

pip install PyQt4

pip install PyQt5

 

필자의 경우는 PySide만 설치가 가능했으며, PySide를 설치한 이후 문제 없이 qtconsole이 실행 되었습니다.

 

 

Jupyter QtConsole 4.2.1
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
 

In [1]:

 

그래픽 라이브러리를 사용하기 위해서는 console에서 동작하기엔 옵션이 필요하다.

그럴땐 notebook을 활용해야 한다.

 

ipython notebook

 

E:\Temp\Data_Science\IPython\chapter\02>ipython notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
C:\Python27\lib\site-packages\widgetsnbextension\__init__.py:30: UserWarning: To use the jupyter-js-widgets nbextension, you'll need to update the Jupyter notebook to version 4.2 or later.
  the Jupyter notebook to version 4.2 or later.""")
[I 10:15:53.674 NotebookApp] Serving notebooks from local directory: E:\Temp\Data_Science\IPython\chapter\02
[I 10:15:53.674 NotebookApp] 0 active kernels
[I 10:15:53.674 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 10:15:53.674 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). 

 





Plot을 사용하는데 다음과 같은 오류가 발생할 경우 32bit 환경에서 사용하였기 때문입니다.

따라서, 64bit로 다시 진행 해 보세요.

 

 

total_births.plot(title='Total births by sex and year') 

error >

c:\python27\lib\lib-tk\Tkinter.py in <module>()
     36 if sys.platform == "win32":
     37     # Attempt to configure Tcl/Tk without requiring PATH
---> 38     import FixTk
     39 import _tkinter # If this fails your Python may not be configured for Tk
     40 tkinter = _tkinter # b/w compat for export

c:\python27\lib\lib-tk\FixTk.py in <module>()
     63     # Compute TK_LIBRARY, knowing that it has the same version
     64     # as Tcl
---> 65     import _tkinter
     66     ver = str(_tkinter.TCL_VERSION)
     67     if "TK_LIBRARY" not in os.environ:

ImportError: DLL load failed: %1은(는) 올바른 Win32 응용 프로그램이 아닙니다.

 

추가적으로 plot이 정상적으로 동작하지 않을 경우 다음과 같이 진행 하면 그래프가 출력 됩니다.

 

 

total_births.plot(title='total births by sex and year')

 

error>

<matplotlib.axes._subplots.AxesSubplot at 0xf05df60>
[이후 아무것도 출력 되지 않음]

 

[해결책]

 

%matplotlib inline 

<matplotlib.axes._subplots.AxesSubplot at 0xf05df60>

[이후 정상적으로 출력 됨.]

 



반응형

+ Recent posts