Python Excel - Reading Excel files with Pandas read_excel

Sdílet
Vložit
  • čas přidán 23. 07. 2024
  • The Python Excel series is a collection of tutorials focused on work with Python and Excel. In this tutorial we introduce one of many methods of working with Excel and Python. We use Pandas read_excel function to create a DataFrame from the excel sheets, look at how to select data including from multiple sheets. Core to working with Excel from Python is the openpyxl library.
    00:00 Introduction
    03:53 Installing openpyxl
    04:45 Importing in an excel file
    Code Repository:
    github.com/veryacademy/Python...
    🏅 Python Beginners Course:
    • Python Course - Beginners
    📋 github.com/veryacademy/Python...
    🐱‍🏍Would you like to SUPPORT US FURTHER so that we can make even more great content - Please consider joining our members community.
    / @veryacademy
    👍SUBSCRIBE to get more free tutorials, courses and code snippets!
    / @veryacademy

Komentáře • 41

  • @ainomugian
    @ainomugian Před 4 dny

    Nice introduction to basic pandas here

  • @Sempredata
    @Sempredata Před 2 měsíci +3

    Took me all day to find this. Thank you

  • @Westcork-ul1ww
    @Westcork-ul1ww Před 2 lety +7

    Thank you. This is exectly what I needed. The last 5 videos I watched had Excel in the title, but only covered read_csv.

  • @yagizjackson9500
    @yagizjackson9500 Před rokem +5

    You are the only one who solved my problem!!! I have had issues for 2-3 weeks and finally i did solve it. Thank you very much!

  • @vancityexe
    @vancityexe Před 2 lety +1

    exactly what I was looking for, thank man!

  • @rezamahdizadeh5755
    @rezamahdizadeh5755 Před 7 měsíci

    This is really helpful for getting started. Thankful

  • @dilipsebastian5742
    @dilipsebastian5742 Před 2 lety +1

    Awesome presentation , thanks for doing this

  • @evansochieng3822
    @evansochieng3822 Před 3 měsíci

    Thanks, this video really helped me out a lot!

  • @sujirnair1
    @sujirnair1 Před 2 lety

    Many Thanks! This video is awesome

  • @pietraderdetective8953

    this is an awesome starter tutorial for Pandas!
    I have a question: how to import an excel file with all the formatting? there are several columns containing data with number and percentage format in the excel file, but upon opening the file with pandas using read_excel then all the formatting gone..it becomes like opening a csv file (no formatting).
    I have added: engine = 'openpyxl' but it does nothing.

  • @1972challenger
    @1972challenger Před rokem +1

    Excellent!

  • @Mr.Aswin_Das
    @Mr.Aswin_Das Před rokem +1

    so usefull, thank you

  • @Olimpico230
    @Olimpico230 Před rokem

    thank you so much ... all the love

  • @gustyflores
    @gustyflores Před rokem +1

    Thank you!!

  • @omoregbeekhator4517
    @omoregbeekhator4517 Před 2 lety +1

    thank you very much for the quick response

  • @saifbasheeral-khoja2678

    Thaks a lot, would you tell me how to get number of rows and colomns?

  • @techOtuts
    @techOtuts Před 2 lety

    Thanks for the nice tutorial. I am on Windows, when try to activate my environment, I get the error message bash: venvscriptsactivate: command not found

  • @mohammadtaghijabbari8071
    @mohammadtaghijabbari8071 Před 4 měsíci

    Perfect ❤

  • @EnzoAuditore
    @EnzoAuditore Před rokem +1

    Thank you for this.

  • @eightsoft
    @eightsoft Před 2 lety

    Great!

  • @mahmedtuny8174
    @mahmedtuny8174 Před 2 lety +1

    Awesome

  • @mrcgunderson1
    @mrcgunderson1 Před 11 měsíci

    I'm having an issue with an xlsb file. If I specify say 450 rows, it will read in the data in about.3 seconds. Having 452 rows of data, if I don't specify the data it will read in the data in 50 seconds. Why is that? Is it attempting to read all the rows in the sheet?

  • @eduardodallagnollaux8426

    how do i import only desirable rows from excel?
    example: i have 10 rows. How to import only the first 5 rows? or how to import only a table that is above or below from another in excel?

  • @VladArnoldner
    @VladArnoldner Před rokem

    If you had 25 sheets, how would you get the total number of the sheets in the workbook? I need to go through a series (all) of sheets and calculate the sum of values from the same cell loacated in all 25 sheets. Thank you!

    • @faridahizoune6757
      @faridahizoune6757 Před 3 měsíci

      I think you have to use a for loop, for i in range(25), and each time return and add the count number to a variable

  • @jacvanderspuy5618
    @jacvanderspuy5618 Před 2 lety +4

    Total beginner and this was perfectly explained. Can pandas handle merged cells? Eg heading over 2 cols? Or should your headings be restricted to 1 row? Cheers

    • @veryacademy
      @veryacademy  Před 2 lety +1

      Something like this might help..
      stackoverflow.com/questions/22937650/pandas-reading-excel-with-merged-cells

  • @anthonychung2907
    @anthonychung2907 Před 2 lety +1

    ImportError: Pandas requires version '1.2.0' or newer of 'xlrd' (version '1.1.0' currently installed). What should I do ?

    • @JHatLpool
      @JHatLpool Před 2 lety

      Ciao Anthony, you have described what I spent most of my day researching ! To install the 'xlrd' module, you need to (using a command window prompt), type 'pip install xlrd'. Then, restart Spyder (or Pycharm, Jupyter Notebook etc. ... whichever you are using) and the reading of other worksheets within the workbook should be achievable. Without 'xlrd', only the first worksheet is read.

  • @patrickjaeger9714
    @patrickjaeger9714 Před 5 měsíci +2

    why using pandas in the first place? all shown can be done in excel.

    • @veryacademy
      @veryacademy  Před 5 měsíci +4

      While it's true that some data manipulation and analysis tasks can be performed in Excel, using Pandas offers several advantages and capabilities that Excel may lack or be less efficient in handling:
      Performance: Pandas is optimized for handling large datasets efficiently, making it much faster than Excel for complex operations on big data.
      Flexibility: Pandas provides a wide range of functions and methods for data manipulation, transformation, and analysis, allowing for more complex and customized workflows than Excel.
      Automation: With Pandas, you can easily automate repetitive tasks and create reusable scripts for data processing, saving time and effort compared to manually performing tasks in Excel.
      Integration: Pandas seamlessly integrates with other Python libraries and tools for data analysis, machine learning, and visualization, providing a more comprehensive and powerful data analysis ecosystem.
      Reproducibility: Using Python scripts with Pandas allows for better reproducibility of data analysis workflows compared to manual operations in Excel, as scripts can be version-controlled and shared with others.
      Scalability: Pandas can handle datasets of virtually unlimited size, making it suitable for analyzing both small and large-scale data.
      Customization: With Pandas, you have full control over data processing and analysis, allowing you to implement custom functions and algorithms tailored to your specific requirements.
      Community and Support: Pandas has a large and active community of users and developers, providing extensive documentation, tutorials, and support resources to help you overcome challenges and learn new techniques.
      Overall, while Excel may suffice for basic data analysis tasks, Pandas offers a more powerful, efficient, and flexible solution for handling and analyzing data, especially when dealing with large or complex datasets.

  • @wilfriedvanhees
    @wilfriedvanhees Před rokem +1

    Good explanation. Unfortunately, is it hard to follow due to the white text on black background

  • @omoregbeekhator4517
    @omoregbeekhator4517 Před 2 lety +2

    no link for the excel files, anyway thanks for the tutorials