read_file2.py 543 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. '''
  4. 使用pandas 读取数据
  5. @Auther :liuyuqi.gov@msn.cn
  6. @Time :2018/7/4 17:15
  7. @File :read_file2.py
  8. '''
  9. from configparser import ConfigParser
  10. import pandas as pd
  11. config_path = "../conf/config.ini"
  12. section_name = "data_file_name"
  13. cf = ConfigParser()
  14. cf.read(config_path)
  15. # app_interference
  16. # app_resources
  17. # instance_deploy
  18. # machine_resources
  19. df = pd.read_csv(cf.get(section_name, "app_interference"), encoding="utf-8")
  20. print("数据类型:", df.dtypes)
  21. print("数据大小:", df.shape)