I have a very large csv file that had different values for certian fields and im wanting to split it up so that each of the different values gets put into its own csv file for example all of the fields whos value is 1110 would get read and written to a file called Pc_Numbers_1110.csv. Is this even possible and if so could someone give me some help on getting started with this.
abaddon2031
0
Junior Poster in Training
Recommended Answers
Jump to PostI think there are 2 ways depending on just how big the file really is.
If it can all be read into memory, then I suggest:
data=[] with open(<csv file name>) as fid: lines=fid.read().split('\n') for i in lines: data.append(i.split(',')) data.sort(key=lambda x: x[3]) for d in data: …
All 4 Replies
rrashkin
41
Junior Poster in Training
abaddon2031
0
Junior Poster in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
rrashkin
41
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.