Importing text file : No Columns to parse from file

前端 未结 2 719
我在风中等你
我在风中等你 2020-12-11 01:49

I am trying to take input from sys.stdin. This is a map reducer program for hadoop. Input file is in txt form. Preview of the data set:

196 242 3   88125094         


        
2条回答
  •  清歌不尽
    2020-12-11 02:15

    You have to set delim_whitespace to True, to use whitespaces as the separator.

    import sys
    import pandas as pd
    
    if __name__ == '__main__':
        df = pd.read_csv(sys.stdin, header=None, delim_whitespace=True)
        print df
    

提交回复
热议问题