【Python 实战基础】Pandas如何将表格的前几行生成html

目录

一、实战场景

二、主要知识点

文件读写

基础语法

Pandas

numpy

三、菜鸟实战

1、创建 python 文件

2、运行结果 


一、实战场景

实战场景:Pandas如何将表格的前几行生成html

二、主要知识点

  • 文件读写

  • 基础语法

  • Pandas

  • numpy

三、菜鸟实战

马上安排!

1、创建 python 文件

import numpy as np
import pandas as pd

np.random.seed(66)
s1 = pd.Series(np.random.rand(20))
s2 = pd.Series(np.random.randn(20))

df = pd.concat([s1, s2], axis=1)
df.columns = ['col1', 'col2']

# df.head 取前5行

print(df.head(5).to_html())

2、运行结果 


 
     
     
     
     
   
 
 
   
     
     
     
   
   
     
     
     
   
   
     
     
     
   
   
     
     
     
   
   
     
     
     
   
 
col1col2
00.154288-0.180981
10.133700-0.056043
20.362685-0.185062
30.679109-0.610935
40.194450-0.048804

 菜鸟实战,持续学习!  

你可能感兴趣的:(Python,实战基础,python,pandas,numpy)