Python Forum
column order changes when copying rows in datafram
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
column order changes when copying rows in datafram
#2
The power of Pandas is you don't need to write such loops. From the code I concluded that you
are trying to select rows from the original dataframe, where values in column 8 are less -20.
Using pandas this could be done easily:
filtered_data = emp_data.loc[emp_data.iloc[:, 8] < -20]
Reply


Messages In This Thread
RE: column order changes when copying rows in datafram - by scidam - Feb-07-2019, 11:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help copying a column from a csv to another file with some extras g0nz0uk 3 472 Feb-01-2024, 03:12 PM
Last Post: DeaD_EyE
  Copying the order of another list with identical values gohanhango 7 1,167 Nov-29-2023, 09:17 PM
Last Post: Pedroski55
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 843 Sep-08-2022, 06:32 AM
Last Post: klllmmm
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,636 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,118 May-04-2021, 10:51 PM
Last Post: rhat398
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 7,135 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  How to filter out Column data From Multiple rows data? firaki12345 10 5,128 Feb-06-2021, 04:54 AM
Last Post: buran
  Copying column values up based on other column values codelines 1 2,067 Jan-03-2021, 05:55 PM
Last Post: codelines
  how to combine rows to a column base on ids zhujp98 0 1,499 Nov-03-2020, 04:10 PM
Last Post: zhujp98
  How to generate rows based on values in a column to fill missing values codesmatter 1 2,139 Oct-31-2020, 12:05 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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