কম্পিউটার টিউটোরিয়াল

পাইথনে ইনডেক্স ছাড়া পান্ডাস ডেটাফ্রেম প্রদর্শন


index=False প্যারামিটার

ইনডেক্স ছাড়া ডেটাফ্রেম প্রিন্ট করতে to_string(index=False) ব্যবহার করুন।

import pandas as pd

কাস্টম ইনডেক্স সহ ডেটাফ্রেম

dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]], index=['x', 'y', 'z'], columns=['a', 'b'])

লোকেশন অনুযায়ী সারি নির্বাচন

dataFrame.loc['x']

ইনডেক্স ছাড়া প্রিন্ট

dataFrame.to_string(index=False)

সম্পূর্ণ উদাহরণ

import pandas as pd
dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]], index=['x', 'y', 'z'], columns=['a', 'b'])
print("Displaying DataFrame with index...\n", dataFrame)
print("\nSelect rows by passing label...")
print(dataFrame.loc['x'])
print("\nDisplaying DataFrame without Index...\n", dataFrame.to_string(index=False))

আউটপুট

Displaying DataFrame with index...
    a   b
x  10  15
y  20  25
z  30  35
Select rows by passing label...
a    10
b    15
Name: x, dtype: int64
Displaying DataFrame without Index...
   a   b
  10  15
  20  25
  30  35
  1. পাইথনে পান্ডাস ডেটাফ্রেম CSV ফাইলে লেখার পদ্ধতি

  2. পাইথনে পান্ডাস ডেটাফ্রেমকে বছরে অনুযায়ী গ্রুপ করা (Grouper ব্যবহার)

  3. পাইথনে পান্ডাস ডেটাফ্রেমের সাবসেট সিলেক্ট করা (সিঙ্গল এবং মাল্টিপল কলাম)

  4. পাইথনে পান্ডাস ডেটাফ্রেমকে বার গ্রাফে প্লট করার পদ্ধতি