΢ Ͷ ^ ھ

青岛队cba赛程 :7Python⼼Ĕ֮·

cba㶫 www.axwwg.com  •rg2020-01-15 16:00:14   ߣ   ҪuՓ(0)

?Peter Nistrup г 7 ùeһЩճļ1. Pandas Profiling2. ʹ Cufflinks

?Peter Nistrup г 7 ù

eһЩճļ

1. Pandas Profiling

2. ʹ Cufflinks Plotly L Pandas

3. IPython ħg

4. Jupyter еĸʽ

5. Jupyter I

6. Jupyter( IPython)ʹһԪͬrжݔ

7. Jupyter Notebook rßƬ

1. Pandas Profiling

ԓЧ@ˆDչʾ{ df.profile_report() @һηĽY

ʹԓֻ谲b͌ Pandas Profiling 

IJԔ@һ˽Ոx

https//towardsdatascience.com/exploring-your-data-with-just-1-line-of-python-4b35ce21a82d

2. ʹ Cufflinks Plotly L Pandas

SġƌWһ򔵓 matplotlib pandas ϤҲfֻ{ .plot() ɿLƺε pd.DataFrame pd.Series

co?

@ѽܺ^ǷLһʽɿsɔUչȫD?Ǖr׌ Cufflinks* *R!(Cufflinks Plotly Mһİb)

ڭhаb CufflinksֻڽK\! pip install cufflinks --upgrade 鿴ˆD

Чö!

עψDΨһ׃ Cufflinks cf.go_offline() ČO .plot() ׃ .iplot()

.scatter_matrix() ҲṩdzĿҕY

Ҫҕx Cufflinks Plotly ęnlF෽

  • Cufflinks ęnhttps//plot.ly/ipython-notebooks/cufflinks/

  • Plotly ęnhttps//plot.ly/

3. IPython ħg

IPython ġħg IPython Python ˜ZһϵħgɷNħg(line magics) % ǰYچ΂ݔ\;Ԫħg(cell magics) %% ǰYڶݔ\e IPython ħgṩһЩùܣ

%lsmagicҳȫ

ֻӛһħgDZ횵@һ %lsmagic ṩпħgб

%debugʽ debug

@ʹõħg

󲿷֔ƌWҶ^@NrеĴaKһֱ break^، 20 print() Zݔÿ׃ăȻKޏ͆}߀÷زٴ΄h print() Z

^ԺҲ@}ֻ %debug ɈҪ\еa֣

ψDаlʲô?

  1. ҂һбݔеżȡƽֵ

  2. ҂\кdzЩ}҂֪ô!

  3. ԓʹ%debug 

  4. ׌{ԇV҂ x type(x) ֵ

  5. }@Ҋ҂'6'ַݔ뵽!

@ڸsĺdz

%store notebook ֮gf׃

@ҲܿO㻨һЩrgϴ notebook еĔFһ notebook МyԇһЩôͬһ notebook ЌFԓ߀DZ攵һ notebook мd?ʹ%store @ЩҪ!ԓ惦׃ notebook Йzԓ׃

  • %store [variable] 惦׃

  • %store -r [variable] xȡ/z惦׃

%whoгȫ׃

Ƿ^׃xֵsӛ׃r?߲СĄhؓ؟׃xֵĆԪ?ʹ%who Եõȫ׃б

%%timeӋrħ

ʹԓԫ@ȡӋrϢֻ茦Ɉдa%%time ͿԵõݔ

%%writefileļԪ

notebook Ќs댢䱣浽ļЕrԓħdzֻ麯ĆԪ %%writefile ǰYҪ浽ļɣ

ʾ҂Ԍĺ浽 utils.py ļȻͿS⌧ notebook Ҳ@ֻҪc utils.py ļͬһĿ䛼

4. Jupyter еĸʽ

@ߺܿ!Jupyter ] markdown д HTML / CSS ʽʹõĹܣ

{ɫrУ

    <div class="alert alert-block alert-info">   This is <b>fancy</b>!</div>

    tɫp΢ŏ

      <div class="alert alert-block alert-danger"> This is <b>baaaaad</b>!</div>

      Gɫƽo

        <div class="alert alert-block alert-success"> This is <b>gooood</b>!</div>

        ˆDչʾ\^̣

        Notebook ʽʬFһЩlFr@dz!

        5. Jupyter I

        ˽͌WIPIʹ壺Ctrl + Shift + P@ȡ notebook йܵбxȡˎׂA

        • EscMģʽģʽʹ÷I notebook MЌ

        ģʽȣ

        • A BڮǰԪϷ(Above)·(Below)µĆԪ

        • MǰԪD Markdown B

        • YǰԪD code B

        • DDhǰԪ

        • EnterǰԪص݋ģʽ


        ھ݋ģʽȣ

        • Shift + TabڮǰԪIČṩęnַ(ęn)mʹԓIѭhʹęnģʽ

        • Ctrl + Shift + -ڹָ̎ǰԪ

        • Esc + FҲQa(ݔ)

        • Esc + OГQԪݔ

        • Shift + Down Shift + Upx·ϷĆԪ

        • Shift + MϲxІԪ

        עxжԪЄh///ճN/\в

        6. Jupyter( IPython)ʹһԪͬrжݔ

        չʾ pandas DataFrame .head() .tail()ڄ\ .tail() ~aԪ^韩ò;ŗǷ^@ӵĽv?Fڲʹ´aչʾչʾݔ

          from IPython.core.interactiveshell import InteractiveShellInteractiveShell.ast_node_interactivity = "all"

          ˆDչF˶ݔĽY

          7. Jupyter Notebook rßƬ

          ʹ RISEԃHͨ^һΰI Jupyter Notebook rD׃ßƬ notebook Ȼ̎ڻSBչʾßƬͬrЌra!

          Ҫʹԓֻͨ^ conda pip b RISE 

            conda install -c conda-forge rise

              pip install RISE

              Fc°o notebook eĻßƬˣ

              P

              • 7Python⼼Ĕ֮·

                7Python⼼Ĕ֮·

                ?Peter Nistrup г 7 ùeһЩճļ1. Pandas Profiling2. ʹ Cufflinks
                2020-01-15
              • 7Python⼼Ĕ֮·

                7Python⼼Ĕ֮·

                ?Peter Nistrup г 7 ùeһЩճļ1. Pandas Profiling2. ʹ Cufflinks
                2020-01-15