目录
实战场景:Pandas如何将表格的前几行生成html
文件读写
基础语法
Pandas
numpy
马上安排!
- 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())
col1
col2
0
0.154288
-0.180981
1
0.133700
-0.056043
2
0.362685
-0.185062
3
0.679109
-0.610935
4
0.194450
-0.048804
菜鸟实战,持续学习!