Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:29:50+00:00 2026-06-12T05:29:50+00:00

I am looking a method to removes all duplicate points from a a X,Y,Z

  • 0

I am looking a method to removes all duplicate points from a a X,Y,Z file. What i wish to code is remove points that have identical x and y coordinates. The first point survives, all subsequent duplicates are removed.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as ml
import matplotlib.delaunay
from matplotlib.mlab import griddata

# my area boundary box
xmax, xmin, ymax, ymin = 640000.06, 636999.83, 6070000.3, 6066999.86

# generate fake data
ndata = 500000
# Generate random data to simulate
x = np.random.randint(xmin, xmax, ndata)
y = np.random.randint(ymin, ymax, ndata)
z = np.random.randint(0,20,ndata)
mypoints = zip(x,y,z)

Thanks in advance for helps and tips!!!
🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:29:51+00:00Added an answer on June 12, 2026 at 5:29 am

    If you run Python 2.7 or higher, you could use an OrderedDict as a filter:

    from collections import OrderedDict
    
    tmp = OrderedDict()
    for point in zip(x, y, z):
        tmp.setdefault(point[:2], point)
    
    mypoints = tmp.values()
    

    Apart from filtering, this also preserves the order of the random sequences.


    Another receipie can be found at the Python documentation, which can be translated to something like:

    from itertools import groupby
    
    keyfunc = lambda p: p[:2]
    mypoints = []
    for k, g in groupby(sorted(zip(x, y, z), key=keyfunc), keyfunc):
        mypoints.append(list(g)[0])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a method to monitor a running program that I have
I was looking for a method in ConcurrentDictionary that allows me to remove an
i'm looking for a method that answers randomly true or false by a given
I'm looking for a method or an event that would get fired when a
Some consultants built some code for us. I'm looking at a method they wrote
I'm looking for a method - if at all possible - of removing a
While looking at the source code of System.ServiceModel.Channels.BufferManager, I noticed this method: void TuneQuotas()
I am looking for a way to quickly remove items from a C# List<T>
i am looking for a method in java, to extract certain bytes from an
I am looking for a method to remove the make error message I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.