背景說明
在使用Python的pandas
套件去做資料分析的時候,我們可以使用.describe()
來獲取各欄位的一個大致的統計描述,而這個時候如果要把這個敘述用Markdown記錄下來,要如何方便的進行呢?
這邊的資料來源
步驟
直接複製貼上
如果直接複製貼上
我們會發現我們得到一個很醜的結果,人或許可以勉強看懂,但你的Markdown編輯器是看不懂的
Weight Length1 Length2 Length3 Height Width
count 159.000000 159.000000 159.000000 159.000000 159.000000 159.000000
mean 398.326415 26.247170 28.415723 31.227044 8.970994 4.417486
std 357.978317 9.996441 10.716328 11.610246 4.286208 1.685804
min 0.000000 7.500000 8.400000 8.800000 1.728400 1.047600
25% 120.000000 19.050000 21.000000 23.150000 5.944800 3.385650
50% 273.000000 25.200000 27.300000 29.400000 7.786000 4.248500
75% 650.000000 32.700000 35.500000 39.650000 12.365900 5.584500
max 1650.000000 59.000000 63.400000 68.000000 18.957000 8.142000
請ChatGPT轉換成Markdown表格
詠唱咒語:
把以下資料轉換成markdown表格,以程式碼區塊包住:
結果:
貼上Markdown編輯器:
Weight | Length1 | Length2 | Length3 | Height | Width | |
---|---|---|---|---|---|---|
count | 159.000000 | 159.000000 | 159.000000 | 159.000000 | 159.000000 | 159.000000 |
mean | 398.326415 | 26.247170 | 28.415723 | 31.227044 | 8.970994 | 4.417486 |
std | 357.978317 | 9.996441 | 10.716328 | 11.610246 | 4.286208 | 1.685804 |
min | 0.000000 | 7.500000 | 8.400000 | 8.800000 | 1.728400 | 1.047600 |
25% | 120.000000 | 19.050000 | 21.000000 | 23.150000 | 5.944800 | 3.385650 |
50% | 273.000000 | 25.200000 | 27.300000 | 29.400000 | 7.786000 | 4.248500 |
75% | 650.000000 | 32.700000 | 35.500000 | 39.650000 | 12.365900 | 5.584500 |
max | 1650.000000 | 59.000000 | 63.400000 | 68.000000 | 18.957000 | 8.142000 |
調整位數也OK
詠唱咒語:
把以下資料轉換成markdown表格,以程式碼區塊包住:
結果:
貼上Markdown編輯器:
Weight | Length1 | Length2 | Length3 | Height | Width | |
---|---|---|---|---|---|---|
count | 159.0 | 159.0 | 159.0 | 159.0 | 159.0 | 159.0 |
mean | 398.3 | 26.2 | 28.4 | 31.2 | 9.0 | 4.4 |
std | 358.0 | 10.0 | 10.7 | 11.6 | 4.3 | 1.7 |
min | 0.0 | 7.5 | 8.4 | 8.8 | 1.7 | 1.0 |
25% | 120.0 | 19.1 | 21.0 | 23.2 | 5.9 | 3.4 |
50% | 273.0 | 25.2 | 27.3 | 29.4 | 7.8 | 4.2 |
75% | 650.0 | 32.7 | 35.5 | 39.7 | 12.4 | 5.6 |
max | 1650.0 | 59.0 | 63.4 | 68.0 | 19.0 | 8.1 |
噹啷,大功告成ヽ(・∀・)ノ