स्प्रेडशीट्स का परिचय

pandas के साथ सरल Data Ingestion

Amany Mahfouz

Instructor

स्प्रेडशीट्स

  • Excel फाइलें भी कहा जाता है
  • डेटा टैबुलर रूप में, पंक्तियों और कॉलमों की कोशिकाओं में
  • फ्लैट फाइलों से अलग, इनमें फॉर्मेटिंग और फ़ॉर्मूला हो सकते हैं
  • एक वर्कबुक में कई स्प्रेडशीट्स हो सकती हैं
pandas के साथ सरल Data Ingestion

स्प्रेडशीट्स लोड करना

  • pandas में स्प्रेडशीट लोड करने का फंक्शन है: read_excel()

FreeCodeCamp के New Developer Survey डेटा का स्प्रेडशीट प्रोग्राम में स्क्रीनशॉट

pandas के साथ सरल Data Ingestion

स्प्रेडशीट्स लोड करना

import pandas as pd

# Read the Excel file
survey_data = pd.read_excel("fcc_survey.xlsx")

# View the first 5 lines of data print(survey_data.head())
    Age  AttendedBootcamp       ...                    SchoolMajor  StudentDebtOwe
0  28.0               0.0       ...                            NaN           20000
1  22.0               0.0       ...                            NaN             NaN
2  19.0               0.0       ...                            NaN             NaN
3  26.0               0.0       ...        Cinematography And Film            7000
4  20.0               0.0       ...                            NaN             NaN

[5 rows x 98 columns]
pandas के साथ सरल Data Ingestion

चयनित कॉलम और पंक्तियाँ लोड करना

मेटाडेटा हेडर पंक्तियों वाली सर्वे डेटा स्प्रेडशीट

कई छोटे डेटा टेबल्स वाली इनवॉइस स्प्रेडशीट

pandas के साथ सरल Data Ingestion

चयनित कॉलम और पंक्तियाँ लोड करना

  • read_excel() में read_csv() जैसे कई कीवर्ड आर्गुमेंट होते हैं
    • nrows: लोड होने वाली पंक्तियों की सीमा
    • skiprows: छोड़ने वाली पंक्तियों की संख्या या पंक्ति नंबर
    • usecols: कॉलम नाम, पोज़िशन नंबर, या अक्षर से चुनें (जैसे "A:P")
pandas के साथ सरल Data Ingestion

चयनित कॉलम और पंक्तियाँ लोड करना

pandas के साथ सरल Data Ingestion

चयनित कॉलम और पंक्तियाँ लोड करना

# Read columns W-AB and AR of file, skipping metadata header
survey_data = pd.read_excel("fcc_survey_with_headers.xlsx",
                            skiprows=2,
                            usecols="W:AB, AR")

# View data print(survey_data.head())
   CommuteTime            CountryCitizen  ...    EmploymentFieldOther    EmploymentStatus   Income
0         35.0  United States of America  ...                     NaN  Employed for wages  32000.0
1         90.0  United States of America  ...                     NaN  Employed for wages  15000.0
2         45.0  United States of America  ...                     NaN  Employed for wages  48000.0
3         45.0  United States of America  ...                     NaN  Employed for wages  43000.0
4         10.0  United States of America  ...                     NaN  Employed for wages   6000.0

[5 rows x 7 columns]
pandas के साथ सरल Data Ingestion

अभ्यास करते हैं!

pandas के साथ सरल Data Ingestion

Preparing Video For Download...