
本文共 1339 字,大约阅读时间需要 4 分钟。
������������
���������������Python������������������������������������������������
pip3 install numpy
pip3 install pandas pip3 install openpyxl������������������������������������������������������������certificate verify failed
���������������������_certifi���
pip3 install certifi
pip3 install openpyxl������
���������������������������������������
import numpy as np
import pandas as pd import openpyxl������������������
data = { "id": [1001, 1002, 1003, 1004, 1005, 1006], "date": pd.date_range('20130102', periods=6), "city": ['Beijing ', 'SH', ' guangzhou ', 'Shenzhen', 'shanghai', 'BEIJING '], "age": [23, 44, 54, 32, 34, 32], "category": ['100-A', '100-B', '110-A', '110-C', '210-A', '130-F'], "price": [1200, np.nan, 2133, 5433, np.nan, 4432] }
������ DataFrame
df = pd.DataFrame( data, columns=['id', 'date', 'city', 'category', 'age', 'price'] )
������������������������
print("������������������������������", df.shape)
���������������������
print("\n������������������") print(df.info())
���������������������������
print("\n������������������������") print(df.dtypes)
������������������������������
print("\n���������������������������") print(df['city'].dtype)
���������3���������
print("\n���3������������") print(df.head(3))
������������������ Excel ������
df.to_excel('Excel_to_Python.xlsx', sheet_name='bluewhale_cc')
发表评论
最新留言
关于作者
