Series की बुनियादी बातें
एक Series data का एक single labelled column है: values plus एक index जो हर एक को नाम देता है।
In this page:
Syntax
s = pd.Series([value1, value2, value3], index=[label1, label2, label3])
Series Basics
एक Series एक index वाला एक one-dimensional array है। अगर आप एक index supply नहीं करते यह 0, 1, 2 वगैरह इस्तेमाल करता है। यह एक dtype hold करता है और fast vectorized maths support करता है।
Note:
एक DataFrame column खुद एक Series है।
उदाहरण: Series basics
import pandas as pd
s = pd.Series([90, 85, 70], index=["math", "art", "music"])
print(s)
print("art:", s["art"])
print(s * 2)
# Output:
# math 90
# art 85
# music 70
# dtype: int64
# art: 85
# math 180
# art 170
# music 140
# dtype: int64
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. #}
आम गलतियां
- यह भूल जाना कि index labels exist करती हैं
- यह मान लेना कि एक Series बिल्कुल एक list जैसा behave करता है
- types mix करना और object dtype पाना
चैप्टर सारांश
- एक Series values plus एक index है
- Default index 0..n-1 है
- यह एक dtype hold करता है
- Maths vectorized है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: