赞
踩
- ########提取csv文件中满足要求的数据##########
-
- import numpy as np #
- import pandas as pd
- import csv
-
- # 1.打开csv文件
- all_data=pd.read_csv('C:\\Users\\86178\\Desktop\\python\\pythonProject\\ethylene_methane.csv')
- # 2.要求(满足Methane列中=0.0且满足Ethylene列中>0.0的数据 )
- some = all_data[(all_data['Methane conc (ppm)'] == 0.0) & (all_data['Ethylene conc (ppm)'] > 0.0)]
- # 3.将满足要求的数据保存到Ethylene.csv文件中
- df=pd.DataFrame(some)
- df.to_csv('C:/Users/86178/Desktop/python/pythonProject/Ethylene.csv')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。