Ipython: ν”Œλ‘œνŒ…ν•  λ•Œ μ„Έλ―Έμ½œλ‘ μ΄ μ–΅μ œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2017λ…„ 09μ›” 12일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: ipython/ipython

λ‚˜λŠ” SO에 λ¬Όμ—ˆκ³  μ—¬κΈ°μ—μ„œ μž¬ν˜„ν•©λ‹ˆλ‹€. 두 개의 셀이 μžˆλŠ” λ…ΈνŠΈλΆ:

[1]μ—μ„œ

import numpy as np
import matplotlib.pyplot as plt
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all";

[2]μ—μ„œ

%matplotlib inline
data ={'first':np.random.rand(100), 
       'second':np.random.rand(100)}
fig, axes = plt.subplots(2)
for idx, k in enumerate(data):
    axes[idx].hist(data[k], bins=20);

plt.hist() 의 좜λ ₯을 μ–΅μ œν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
screen shot 2017-09-12 at 20 43 35

νŒŒμ΄μ¬μ—μ„œ 좜λ ₯ -c "import IPython; print(IPython.sys_info())"

{'commit_hash': 'd86648c5d',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Users/okomarov/anaconda/lib/python3.6/site-packages/IPython',
 'ipython_version': '6.1.0',
 'os_name': 'posix',
 'platform': 'Darwin-16.7.0-x86_64-i386-64bit',
 'sys_executable': '/Users/okomarov/anaconda/bin/python3',
 'sys_platform': 'darwin',
 'sys_version': '3.6.2 |Anaconda custom (x86_64)| (default, Jul 20 2017, '
                '13:14:59) \n'
                '[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]'}

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

InteractiveShell.ast_node_interactivity = "all"; μ„€μ •ν–ˆμœΌλ―€λ‘œ λͺ¨λ“  λ…Έλ“œκ°€ ast μƒν˜Έ μž‘μš©μ„ ν™œμ„±ν™”ν•˜λ„λ‘ μ„€μ •ν–ˆμŠ΅λ‹ˆλ‹€.

그리고 ; λŠ” λ§ˆμ§€λ§‰ μ΅œμƒμœ„ ν‘œν˜„μ‹μ— λŒ€ν•΄μ„œλ§Œ μž‘λ™ν•©λ‹ˆλ‹€. axes[idx].hist(data[k], bins=20); λŠ” for μ€‘μ²©λ˜μ–΄ μžˆμœΌλ―€λ‘œ μ΅œμƒμœ„ 레벨이 μ•„λ‹™λ‹ˆλ‹€. λ§ˆμ§€λ§‰ μ΅œμƒμœ„ λ…Έλ“œμ˜ 경우 for , 이것은 λͺ…λ Ήλ¬Έμž…λ‹ˆλ‹€.

λ§ˆμ§€λ§‰ no-op 문을 μΆ”κ°€ν•˜κ³  ; λλƒ…λ‹ˆλ‹€.

%matplotlib inline
data ={'first':np.random.rand(100), 
       'second':np.random.rand(100)};
fig, axes = plt.subplots(2);
for idx, k in enumerate(data):
    axes[idx].hist(data[k], bins=20)
pass;

그리고 당신은 μ–΄λ–€ 좜λ ₯도 갖지 μ•Šμ„ κ²ƒμž…λ‹ˆλ‹€.

λͺ¨λ“  3 λŒ“κΈ€

InteractiveShell.ast_node_interactivity = "all"; μ„€μ •ν–ˆμœΌλ―€λ‘œ λͺ¨λ“  λ…Έλ“œκ°€ ast μƒν˜Έ μž‘μš©μ„ ν™œμ„±ν™”ν•˜λ„λ‘ μ„€μ •ν–ˆμŠ΅λ‹ˆλ‹€.

그리고 ; λŠ” λ§ˆμ§€λ§‰ μ΅œμƒμœ„ ν‘œν˜„μ‹μ— λŒ€ν•΄μ„œλ§Œ μž‘λ™ν•©λ‹ˆλ‹€. axes[idx].hist(data[k], bins=20); λŠ” for μ€‘μ²©λ˜μ–΄ μžˆμœΌλ―€λ‘œ μ΅œμƒμœ„ 레벨이 μ•„λ‹™λ‹ˆλ‹€. λ§ˆμ§€λ§‰ μ΅œμƒμœ„ λ…Έλ“œμ˜ 경우 for , 이것은 λͺ…λ Ήλ¬Έμž…λ‹ˆλ‹€.

λ§ˆμ§€λ§‰ no-op 문을 μΆ”κ°€ν•˜κ³  ; λλƒ…λ‹ˆλ‹€.

%matplotlib inline
data ={'first':np.random.rand(100), 
       'second':np.random.rand(100)};
fig, axes = plt.subplots(2);
for idx, k in enumerate(data):
    axes[idx].hist(data[k], bins=20)
pass;

그리고 당신은 μ–΄λ–€ 좜λ ₯도 갖지 μ•Šμ„ κ²ƒμž…λ‹ˆλ‹€.

@Carreau μ„€λͺ… κ°μ‚¬ν•©λ‹ˆλ‹€!

λ‹€μŒμ— λŒ€ν•΄ 찾을 수 μ—†μŠ΅λ‹ˆλ‹€.

그리고 ; λ§ˆμ§€λ§‰ μ΅œμƒμœ„ ν‘œν˜„μ‹μ— λŒ€ν•΄μ„œλ§Œ μž‘λ™ν•©λ‹ˆλ‹€.

μ–΄λ”˜κ°€μ— λ¬Έμ„œν™”λ˜μ–΄ μžˆμŠ΅λ‹ˆκΉŒ? λ‚΄κ°€ μˆ˜λ½ν•  수 μžˆλ„λ‘ 닡변을 λ³΅μ‚¬ν•˜μ—¬ SO에 λΆ™μ—¬λ„£μœΌμ‹œκ² μŠ΅λ‹ˆκΉŒ?

μ–΄λ”˜κ°€μ— λ¬Έμ„œν™”λ˜μ–΄ μžˆμŠ΅λ‹ˆκΉŒ?

μ•„λ§ˆλ„ 그렇지 μ•Šμ„ κ²ƒμž…λ‹ˆλ‹€. ast_interactivity μ˜΅μ…˜μ€ 거의 μ‚¬μš©λ˜μ§€ μ•ŠμœΌλ―€λ‘œ _λŒ€λΆ€λΆ„μ˜_ μ‚¬μš© μ‚¬λ‘€λŠ” λ§ˆμ§€λ§‰ ν‘œν˜„μ‹μ—λ§Œ μ μš©λ˜λ―€λ‘œ ꡬ뢄에 신경쓰지 μ•ŠμŠ΅λ‹ˆλ‹€.

λ‚΄κ°€ μˆ˜λ½ν•  수 μžˆλ„λ‘ 닡변을 λ³΅μ‚¬ν•˜μ—¬ λΆ™μ—¬λ„£μœΌμ‹œκ² μŠ΅λ‹ˆκΉŒ?

λͺ‡ 가지 λ‹€λ₯Έ μ„ΈλΆ€ 사항과 ν•¨κ»˜ 이미 ν–ˆμŠ΅λ‹ˆλ‹€ :-)

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰