কম্পিউটার

Python Pandas - সমস্ত ডুপ্লিকেট সূচক মান সত্য হিসাবে নির্দেশ করুন


সমস্ত ডুপ্লিকেট সূচক মান সত্য হিসাবে নির্দেশ করতে, index.duplicated() ব্যবহার করুন . কিপ ব্যবহার করুন False মান সহ প্যারামিটার

প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -

import pandas as pd

কিছু সদৃশ −

দিয়ে সূচক তৈরি করা হচ্ছে
index = pd.Index(['Car','Bike','Airplane','Ship','Airplane'])

সূচক প্রদর্শন করুন -

print("Pandas Index with duplicates...\n",index)

সমস্ত ডুপ্লিকেট সূচক মান সত্য হিসাবে নির্দেশ করুন। "কিপ" প্যারামিটারটিকে "ফলস" হিসাবে সেট করুন −

print("\nIndicating all duplicate index values True...\n", index.duplicated(keep=False))

উদাহরণ

নিম্নলিখিত কোড -

import pandas as pd

# Creating the index with some duplicates
index = pd.Index(['Car','Bike','Airplane','Ship','Airplane'])

# Display the index
print("Pandas Index with duplicates...\n",index)

# Return the dtype of the data
print("\nThe dtype object...\n",index.dtype)

# get the dimensions of the data
print("\nGet the dimensions...\n",index.ndim)

# Indicate all duplicate index values as True
# Set the "keep" parameter as "False"
print("\nIndicating all duplicate index values True...\n", index.duplicated(keep=False))

আউটপুট

এটি নিম্নলিখিত কোড তৈরি করবে -

Pandas Index with duplicates...
Index(['Car', 'Bike', 'Airplane', 'Ship', 'Airplane'], dtype='object')

The dtype object...
object

Get the dimensions...
1

Indicating all duplicate index values True...
[False False True False True]

  1. পাইথন - পান্ডাসে সমস্ত নাল মান সহ একটি কলাম সরান

  2. পাইথন - একটি পান্ডাস ডেটাফ্রেমে অসীম মানগুলির জন্য সত্য প্রদর্শন করুন

  3. পাইথন - একটি পান্ডাস ডেটাফ্রেম থেকে ডুপ্লিকেট মানগুলি সরান

  4. Python Pandas-এ দুটি সূচক মানের মধ্যে DataFrame সারি নির্বাচন করুন