কম্পিউটার

Python Pandas - অন্তর্নিহিত ডেটার dtype অবজেক্ট ফেরত দিন


অন্তর্নিহিত ডেটার dtype অবজেক্ট ফেরত দিতে, index.dtype ব্যবহার করুন পান্ডাসে সম্পত্তি।

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

import pandas as pd

সূচক তৈরি করা হচ্ছে -

index = pd.Index(['Car','Bike', 'Shop','Car','Airplace', 'Truck'])

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

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

ডেটার টাইপ −

ফেরত দিন
print("\nThe dtype object...\n",index.dtype)

উদাহরণ

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

import pandas as pd

# Creating the index
index = pd.Index(['Car','Bike', 'Shop','Car','Airplace', 'Truck'])

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

# Return an array representing the data in the Index
print("\nArray...\n",index.values)

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

# Return a tuple of the shape of the underlying data
print("\nA tuple of the shape of underlying data...\n",index.shape)

আউটপুট

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

Pandas Index...
Index(['Car', 'Bike', 'Shop', 'Car', 'Airplace', 'Truck'], dtype='object')

Array...
['Car' 'Bike' 'Shop' 'Car' 'Airplace' 'Truck']

The dtype object...
object

A tuple of the shape of underlying data...
(6,)

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

  2. Python Pandas - Timedelta অবজেক্টের সর্বোচ্চ মান ফেরত দিন

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

  4. পাইথন - পান্ডাস সূচকে সুনির্দিষ্ট ডেটা আছে কিনা তা পরীক্ষা করুন