0

I have Data of different Stocks of various dates and each stock is stored in different Text Files (not in CSV) How to Gather up Data in some way into a Single File

  • Welcome to StackOverflow. Please take the time to read this post on [how to provide a great pandas example](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) as well as how to provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) and revise your question accordingly. These tips on [how to ask a good question](http://stackoverflow.com/help/how-to-ask) may also be useful. – jezrael Mar 14 '18 at 08:01

2 Answers2

0

you can use something like pandas and load each file to a data frame and then merge all of the data frames together, you can find some info here

https://pandas.pydata.org/pandas-docs/stable/io.html

Diab
  • 142
  • 7
0

If you want to merge all the text files into a single one, use a command type(if linux, use cat). Firstly, cd to the directory your text files in(for example: E:\data).

cd E:\data\ 
type *.txt > all.csv

and then you can use pandas

df = pd.read_csv("all.csv")
...
Lambda
  • 1,392
  • 1
  • 9
  • 11