Python Forum
Looping Through Large Data Sets
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping Through Large Data Sets
#5
(Oct-03-2020, 04:06 AM)buran Wrote: can you provide sample dataframe (no need of 60 000 rows, just 2-3 rows is sufficient)
Ideal would be to provide a code that creates a DataFrame with the same structure as yours - like I did in my example which works.

Hi buran

My apologies for not getting back to you sooner.

I have tried several ways to get your method of looping through the data however I still cannot get it to work and I dont understand why.

I have re-created the data set along with the code you suggested which is:-

import pandas
 
raw_data = pandas.DataFrame(columns=["Column_0", "Column_1", "Column_2", "Column_3", "Column_4", "Column_5", "Column_6", "Column_7", "Column_8"])

raw_data.loc[0,:] = ("315589", "CHZ3", "1100", "218", "694.63", "nan", "-1.589", "0", "1.3694")

raw_data.loc[1,:] = ("364048", "CHZ3", "1100", "320", "12.09", "nan", "-7.216", "0", "59.89")

raw_data[5] = raw_data[3] * 8950 + raw_data[4]



#raw_data.iloc[:,5] = raw_data.iloc[:,3] * 8950 + raw_data.iloc[:,4]
If you run the code as it is you will see that i get an error if i follow your method, however if comment out the code you suggested and uncomment out the last line it works fine.

But i want to understand why your suggestion does not work?

I think i am going crazy?

Thank you.
Reply


Messages In This Thread
Looping Through Large Data Sets - by JoeDainton123 - Oct-02-2020, 06:59 PM
RE: Looping Through Large Data Sets - by buran - Oct-02-2020, 07:07 PM
RE: Looping Through Large Data Sets - by buran - Oct-03-2020, 04:06 AM
RE: Looping Through Large Data Sets - by JoeDainton123 - Oct-16-2020, 09:41 PM
RE: Looping Through Large Data Sets - by buran - Oct-17-2020, 06:27 AM
RE: Looping Through Large Data Sets - by buran - Oct-17-2020, 02:44 PM
RE: Looping Through Large Data Sets - by jefsummers - Oct-18-2020, 12:53 PM
RE: Looping Through Large Data Sets - by buran - Oct-18-2020, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Peculiar pattern from printing of sets SahandJ 7 1,708 Dec-29-2021, 06:31 PM
Last Post: bowlofred
  How does one combine 2 data sets ? detlefschmitt 2 1,717 Sep-03-2021, 03:38 AM
Last Post: detlefschmitt
  Looping to read data in database CEC68 1 1,740 Sep-24-2020, 08:54 PM
Last Post: scidam
  comprehension for sets Skaperen 2 1,877 Aug-07-2020, 10:12 PM
Last Post: Skaperen
  Extract data from large string pzig98 1 2,147 Jul-20-2020, 12:39 AM
Last Post: Larz60+
  Moving large amount of data between MySql and Sql Server using Python ste80adr 4 3,459 Apr-24-2020, 01:24 PM
Last Post: Jeff900
  alternative to nested loops for large data set JonnyEnglish 2 2,602 Feb-19-2020, 11:26 PM
Last Post: JonnyEnglish
  Looping JSON data graham23s 1 2,079 Jul-01-2019, 09:37 PM
Last Post: nilamo
  Sort sets by item values Sergey 4 75,241 Apr-19-2019, 10:50 AM
Last Post: Sergey
  Problem with character sets Pedroski55 4 3,776 Mar-04-2019, 02:35 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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