← Back to Pandas Course | Chapter 3: DataFrame Basics | Lesson 3 of 7

head/tail/info/describe का उपयोग

Analyse करने से पहले एक table देखने के लिए चार quick commands।

In this page:

  1. head/tail/info/describe
Syntax
python
df.head(n)
df.tail(n)
df.info()
df.describe()

head/tail/info/describe

head और tail rows preview करते हैं, info column names, non-null counts, और dtypes print करता है, और describe numeric columns के लिए summary statistics देता है। हर column describe करने के लिए include="all" इस्तेमाल करें। एक नए dataset पर हमेशा पहले ये चलाएँ।

Note: info() missing values और wrong dtypes spot करने का सबसे fast तरीका है।

उदाहरण: head/tail/info/describe

python
import pandas as pd

df = pd.DataFrame({"a": [1, 2, 3, 4], "b": [10.5, None, 30.5, 40.5]})
print(df.head(2))
df.info()
print(df.describe())

# Output:
#    a     b
# 0  1  10.5
# 1  2   NaN
# <class 'pandas.core.frame.DataFrame'>
# RangeIndex: 4 entries, 0 to 3
# Data columns (total 2 columns):
#  #   Column  Non-Null Count  Dtype
# ---  ------  --------------  -----
#  0   a       4 non-null      int64
#  1   b       3 non-null      float64
# dtypes: float64(1), int64(1)
# memory usage: 196.0 bytes
#               a          b
# count  4.000000   3.000000
# mean   2.500000  27.166667
# std    1.290994  15.275252
# min    1.000000  10.500000
# 25%    1.750000  20.500000
# 50%    2.500000  30.500000
# 75%    3.250000  35.500000
# max    4.000000  40.500000
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. data का पहला look skip करना
  2. count check किए बिना describe पढ़ना
  3. यह भूल जाना कि describe default से text ignore करता है
चैप्टर सारांश
  • head और tail rows preview करते हैं
  • info dtypes और non-nulls दिखाता है
  • describe numbers summarize करता है
  • include="all" text cover करता है
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.