Trying to parse text files in python for data analysis

后端 未结 3 1232
执念已碎
执念已碎 2021-01-21 13:38

I do a lot of data analysis in perl and I am trying to replicate this work in python using pandas, numpy, matplotlib, etc.

The general workflow goes as follows:

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 14:41

    To glob your files, use the built-in glob module in Python.

    To read your csv files after globbing them, the read_csv function that you can import using from pandas.io.parsers import read_csv will help you do that.

    As for MultiIndex feature in the pandas dataframe that you instantiate after using read_csv, you can then use them to organize your data and slice them anyway you want.

    3 pertinent links for your reference.

    • Understanding MultiIndex dataframes in pandas - understanding MultiIndex and Benefits of panda's multiindex?
    • Using glob in a directory to grab and manipulate your files - extract values/renaming filename in python

提交回复
热议问题