Upgrade to Pro — share decks privately, control downloads, hide ads and more …

pandasのStyling機能で強化するJupyter実験レポート / PyConJP 2019

komo_fr
September 16, 2019

pandasのStyling機能で強化するJupyter実験レポート / PyConJP 2019

komo_fr

September 16, 2019
Tweet

More Decks by komo_fr

Other Decks in Programming

Transcript

  1. @komo_fr 5PNPLP'636,*
 5XJUUFS!LPNP@GS w 1Z$PO+1΁ͷొஃ͸ճ໨ w લ৬1ZUIPOΛ࢖ͬͨσʔλ׆༻ͷ1P$΍ػցֶशҊ݅ʹैࣄ w ݱࡏϑϦʔ w

    ͨ·ʹ1ZUIPOຊͷϨϏϡʔ΋ͯ͠Δ w ʮ1ZUIPOʹΑΔ͋ͨΒ͍͠σʔλ෼ੳͷڭՊॻʯ w ᠳӭࣾࣉాֶ ⁋ਅޗ ླ໦͔ͨͷΓ ෱ౡਅଠ࿕ w ʮͰ͖Δ࢓ࣄ͕͸͔ͲΔ1ZUIPOࣗಈॲཧશ෦ೖΓɻʯ w ΠϯϓϨεຊ఩໵ த໺ਖ਼ً ஑ప Ԭా޾େ !2 8IPBN*
  2. @komo_fr w ಺༰ w ศརͳ͕Β΋ॻ੶Ͱ͸͋·Γ঺հ͞Εͳ͍
 QBOEBTͷ4UZMJOHػೳʹ͍ͭͯɺ
 جຊతͳ࢖͍ํɾར༻ྫɾ஫ҙ఺ͳͲΛ঺հ͠·͢ w ର৅#FHJOOFS w

    ීஈɺ+VQZUFS/PUFCPPLͰ࣮ݧϨϙʔτΛॻ͘ػձ͕͋Δ
 QBOEBTϢʔβ w 4MJEF w IUUQTTQFBLFSEFDLDPNLPNPGSQZDPOKQ !4 ࠓ೔࿩͢͜ͱ
  3. @komo_fr w 4UZMJOHػೳͱ͸ w 4UZMJOHػೳΛ࢖͏Ϟνϕʔγϣϯ w جຊͷ࢖͍ํ w ϏϧτΠϯؔ਺ w

    &YDFM΁ͷΤΫεϙʔτ w 4UZMJOHػೳ࢖༻࣌ͷ஫ҙ఺ !10 "HFOEB
  4. @komo_fr w σʔλΛѻ͏தͰɺ+VQZUFS্Ͱ%BUB'SBNFͷத਎Λ֬ೝ͢Δ w ͦͷதͰɺ%BUB'SBNFͷҰ෦ͷηϧΛڧௐͯ͠ද͍ࣔͨ͠ͱ͖͕͋Δ w FY ߦຖͷ࠷େ஋ɺܽଛ஋ʜʜ w γνϡΤʔγϣϯ

    w ࣗ෼ͰσʔλΛ୳ࡧͯ͠ࢼߦࡨޡ͍ͯ͠Δͱ͖ w άϥϑͷܗʹཁ໿ͤͣʹɺςʔϒϧͷ··၆ᛌ͍ͨ͠ͱ͖ w ࣮ݧޙʹɺଞऀʹ޲͚ͨใࠂࢿྉΛ࡞Δͱ͖ w ʮදͷ͜͜ͷ෦෼͕ϙΠϯτͰ͢ΑʯͱҰ෦Λ͍ࣔͨ͠ͱ͖ !11 4UZMJOHػೳΛ࢖͏Ϟνϕʔγϣϯ
  5. @komo_fr w QBOEBT+VQZUFS/PUFCPPL͔Βಈ͔ͳ͍͍ͯ͘ w ใࠂࢿྉͷ৔߹ ͪΐͬͱͨ͠૷০ͷͨΊʹ
 ύϫϙʹҠಈͨ͘͠ͳ͍ w ίʔυͰهड़͍ͯ͠Δ࠶ར༻ࣗಈԽ͠΍͍͢ w

    +VQZUFS/PUFCPPLͰϨϙʔτͷϑΥʔϚοτΛ࡞ͬͯ
 ಉ༷͡ͳ࣮ݧΛԿ౓΋܁ΓฦͤΔ w Ұ౓࡞ͬͨελΠϧͷઃఆʢελΠϧؔ਺ʣΛɺ
 ผͷςʔϚͷ࣮ݧͰ΋࢖͍ճͤΔ !13 Կ͕خ͍͠ͷ͔
  6. @komo_fr  $44จࣈྻΛฦ͢ελΠϧؔ਺Λఆٛ͢Δ  BQQMZNBQ·ͨ͸BQQMZΛ࢖ͬͯɺελΠϧؔ਺Λద༻͢Δ ͨͩ͠ద༻͍ͨ͠୯ҐʢཁૉPSߦྻσʔλϑϨʔϜʣʹΑͬͯ
 ελΠϧؔ਺ͷҾ਺ɾ໭Γ஋΍ɺ࢖͏ϝιου͕มΘΔ ελΠϧద༻ͷجຊ "SBLJ #BCB

    $IPV ࠃ ޠ    ਺ ֶ    ཧ Պ    ࣾ ձ    "SBLJ #BCB $IPV ࠃ ޠ    ਺ ֶ    ཧ Պ    ࣾ ձ    "SBLJ #BCB $IPV ࠃ ޠ    ਺ ֶ    ཧ Պ    ࣾ ձ    BQQMZNBQ BQQMZ BYJT BYJT !15
  7. @komo_fr ྫ੺఺ͷ੒੷Λ੺ࣈʹ͢Δ !18  ηϧͷ஋ʹԠͯ͡ $44Λฦ͢ ελΠϧؔ਺Λ ༻ҙ  

    TUZMFBQQMZNBQϝιουʹ ελΠϧؔ਺Λ౉ͯ͠ ֤ཁૉʹద༻͢Δ
  8. @komo_fr w QBOEBTJPGPSNBUTTUZMF4UZMFSΫϥε w )5.-ͱ$44Λ࢖ͬͯ
 %BUB'SBNF΍4FSJFTͷελΠϧΛઃఆ͢ΔΫϥε w BQQMZNBQ BQQMZͳͲελΠϧΛద༻͢ΔϝιουΛ࣋ͭ w

    4UZMFSΦϒδΣΫτΛ+VQZUFS্Ͱ࣮ߦ͢Δͱɺ
 @SFQS@IUNM@ϝιου͕ࣗಈͰݺ͹ΕͯϨϯμϦϯά͞ΕΔ w %BUB'SBNFTUZMFϓϩύςΟ w 4UZMFSΦϒδΣΫτΛฦ͢ !20 4UZMFSΫϥε%BUB'SBNFTUZMFϓϩύςΟ
  9. @komo_fr w ʮ஋͕఺ະຬ͔Ͳ͏͔ʯʮηϧ͕OVMM͕Ͳ͏͔ʯͳͲ w ֤ཁૉͷ஋ΛݸผʹݟΕ͹Θ͔Δ w BQQMZNBQ Λ࢖͏ w ʮશͯͷߦͰҰ൪େ͖͍஋ͷഎܠ৭Λม͑ΔʯʮલͷߦΑΓେ͖

    ͍஋ͩͬͨΒจࣈ৭Λม͑ΔʯͳͲ w ୯ମͷཁૉ͚ͩͰ͸ͳ͘ɺ
 ଞͷཁૉ΋ؚΊͯ൑அ͢Δඞཁ͕͋Δ w BQQMZ Λ࢖͏ !25 ߦશମɾྻશମΛݟΔඞཁ͕͋Δ৔߹
  10. @komo_fr w IJHIMJHIU@NBY IJHIMJHIU@NJO  w ࠷େ஋ɺ࠷খ஋ͷഎܠ৭Λม͑ΔʢσϑΥϧτͰ͸ԫ৭ʣ w IJHIMJHIU@OVMM 

    w OVMMͷηϧͷഎܠ৭Λม͑ΔʢσϑΥϧτͰ͸੺ʣ w CBS  w ηϧͷഎܠʹ๮άϥϑΛඳ͘ w ݸਓతʹ͸Ұ൪ଟ༻͢Δ w CBDLHSPVOE@HSBEJFOU  w ஋ʹԠͯ͡എܠΛάϥσʔγϣϯ͢Δ !28 Α͘࢖͏ελΠϧؔ਺͸͋Β͔͡Ί༻ҙ͞Ε͍ͯΔ
  11. @komo_fr w TFU@DBQUJPO  w ςʔϒϧʹΩϟϓγϣϯΛ͚ͭΔ w TFU@QSFDJTJPO  w

    දࣔ͢Δࡍͷ༗ޮܻ਺Λࢦఆ w σʔλͦͷ΋ͷʹ͸Өڹ͸ͳ͍ w TFU@QSPQFSUJFT  w ελΠϧؔ਺Λ࢖Θͣɺ௚઀$44Λࢦఆ w σʔλͷ৚݅ʹΑΒͣɺ
 ҰׅͰಉ͡ελΠϧΛద༻͍ͨ͠ͱ͖ʹศར !32 ͦͷଞͷศརͳػೳ ˣΩϟϓγϣϯ
  12. @komo_fr w 4UZMJOHc6TFS(VJEF w ͱ͸͍͑ɺॳճϦϦʔεͷ͔Βطʹ໿೥ܦա w ϦϦʔε w (JUͷίϛοτϩάΛݟͨͱ͜Ζɺසൟʹػೳ௥Ճ͕͋ΔΘ͚Ͱ ͸ͳ͍͕ɺυΩϡϝϯτ΍ίʔυ੔ܗπʔϧͷద༻ͳͲ


    ϝϯς͸͞Ε͍ͯΔΈ͍ͨʁ !39 ͋͘·Ͱ1SPWJTJPOBM 1SPWJTJPOBM5IJTJTBOFXGFBUVSFBOETUJMMVOEFS EFWFMPQNFOU8F`MMCFBEEJOHGFBUVSFT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