সমস্ত ডুপ্লিকেট সূচক মান সত্য হিসাবে নির্দেশ করতে, 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]