Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Removing rows from array
#1
Hello, I want to replicate this Matlab code into Python

FILE(1:985,:) = [ ];

FILE is an nx2 array. n si quite large but it's not important. If I understand correctly, the code should remove from the FILE array all rows from first to 985th.

This is what I've come up with in Python

FILE = np.delete(FILE, FILE[0:985,...].astype('int'), axis = 0)
However it doesn't seem to work as I want, it removes only 19 rows from the array.

Why is that?

Here you can find the FILE array: https://pastebin.com/ it's a 40.001 x 2

The resulting FILE at the end should be 39.016 x 2 but I get 39.982 x 2
Reply


Messages In This Thread
Removing rows from array - by claw91 - Sep-17-2020, 02:58 PM
RE: Removing rows from array - by scidam - Sep-17-2020, 11:49 PM
RE: Removing rows from array - by claw91 - Sep-18-2020, 01:50 PM
RE: Removing rows from array - by scidam - Sep-18-2020, 11:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,645 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Calculate next rows based on previous values of array divon 0 1,803 Nov-23-2021, 04:44 AM
Last Post: divon
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,138 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,209 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
Question Dataframe Manipulation Coping Rows and Removing Dates ashleysnl 1 1,800 Feb-26-2021, 10:00 PM
Last Post: nilamo
  Removing some elements from array based on a condition claw91 0 1,529 Oct-27-2020, 03:42 PM
Last Post: claw91

Forum Jump:

User Panel Messages

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