কম্পিউটার

পাইথন - একটি পান্ডাস সূচকে কোন এন্ট্রিগুলি NA নয় তা দেখান৷


একটি পান্ডাস সূচকে কোন এন্ট্রিগুলি NA নয় তা দেখানোর জন্য, index.notna() ব্যবহার করুন পদ্ধতি প্রথমে, প্রয়োজনীয় লাইব্রেরি আমদানি করুন -

import pandas as pd
import numpy as np

কিছু NaN মান দিয়ে পান্ডাস সূচক তৈরি করা হচ্ছে −

index = pd.Index([5, 65, np.nan, 17, 75, np.nan])

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

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

একটি পান্ডাস সূচকে কোন এন্ট্রি দেখান-NA নয়। নন-এনএ এন্ট্রির জন্য সত্য প্রত্যাবর্তন −

print("\nCheck which entries are not-NA...\n", index.notna())

উদাহরণ

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

import pandas as pd
import numpy as np

# Creating Pandas index with some NaN values
index = pd.Index([5, 65, np.nan, 17, 75, np.nan])

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

# Return the number of elements in the Index
print("\nNumber of elements in the index...\n",index.size)

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

# Show which entries in a Pandas index are not-NA
# Return True for non-NA entries
print("\nCheck which entries are not-NA...\n", index.notna())

আউটপুট

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে
Pandas Index...
Float64Index([5.0, 65.0, nan, 17.0, 75.0, nan], dtype='float64')

Number of elements in the index...
6

The dtype object...
float64

Check which entries are not-NA...
[ True True False True True False]

  1. পাইথন - পান্ডাস সূচকের সর্বনিম্ন মান ফেরত দিন

  2. পাইথন - পান্ডাস সূচকটি অবজেক্ট dটাইপের কিনা তা পরীক্ষা করুন

  3. Python Pandas - ডেটাফ্রেম অবজেক্ট সমান কিনা তা পরীক্ষা করুন

  4. যদি নির্দিষ্ট সূচকটি পাইথন পান্ডাস সিরিজে উপস্থিত না থাকে তবে কী হবে?