Python Forum
My python code is running very slow on millions of records
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My python code is running very slow on millions of records
#7
(Dec-28-2021, 02:23 AM)Larz60+ Wrote: untested, but close:
import pandas as pd
import glob

path = Your csv file path
os.path.join(path, "*.csv")
filelist = glob.glob(path + "/*.csv")

df = pd.concat((pd.read_csv(f) for f in filelist))
df = df.fillna('') # replace nan

I have attached test.csv file for testing.
Reply


Messages In This Thread
RE: My python code is running very slow on millions of records - by shantanu97 - Dec-28-2021, 02:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in running a code akbarza 7 781 Feb-14-2024, 02:57 PM
Last Post: snippsat
  writing and running code in vscode without saving it akbarza 1 464 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 599 Nov-10-2023, 08:09 AM
Last Post: akbarza
  validate large json file with millions of records in batches herobpv 3 1,352 Dec-10-2022, 10:36 PM
Last Post: bowlofred
  How to retrieve records in a DataFrame (Python/Pandas) that contains leading or trail mmunozjr 3 1,858 Sep-05-2022, 11:56 AM
Last Post: Pedroski55
  Code running many times nad not just one? korenron 4 1,438 Jul-24-2022, 08:12 AM
Last Post: korenron
  Error while running code on VSC maiya 4 3,966 Jul-01-2022, 02:51 PM
Last Post: maiya
  code running for more than an hour now, yet didn't get any result, what should I do? aiden 2 1,587 Apr-06-2022, 03:41 PM
Last Post: Gribouillis
  Why is this Python code running twice? mcva 5 5,449 Feb-02-2022, 10:21 AM
Last Post: mcva
  Python keeps running the old version of the code quest 2 3,919 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020