Python Pandas Tutorial ( Basics ) - Start Replacing Excel for Python 2021 Series

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ก.ค. 2024
  • In this one we'll take a look at how we can start using pandas to do simple tasks
    Spreadsheet to work alongside me -- www.kaggle.com/tunguz/gold-pr...
    Kite helps fund the channel, thanks for checking them out and supporting me -- www.kite.com/get-kite/?...
    ⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing.
    Merch Store --
    derricksherrill.store/
    Support the Channel on Patreon --
    / derricksherrill
    Join The Socials --
    Reddit - / codewithderrick
    FB - / codewithderrick
    Insta - / codewithderrick
    Twitter - / codewithderrick
    LinkedIn - / derricksherrill
    GitHub - github.com/Derrick-Sherrill
    *****************************************************************
    0:00 Introduction
    0:50 Viewing The Data Source
    1:14 Setting up Pandas
    1:30 Importing Data
    2:25 Viewing Data
    3:34 Selecting Columns
    4:40 Simple Operations
    8:20 Graphing Data
    9:56 Viewing Graph
    Full code from the video:
    import pandas as pd
    import plotly.express as px
    df_gold_prices = pd.read_csv('monthly_gold_prices.csv')
    Viewing data
    print(df_gold_prices.tail(20))
    dates = df_gold_prices['Date']
    prices = df_gold_prices['Price']
    simple operations
    df_gold_prices['buy_price'] = prices * .9
    print(df_gold_prices['Price'].max())
    df_gold_prices['Date'] = df_gold_prices['Date'].str.replace('-', '')
    print(df_gold_prices)
    fig = px.line(df_gold_prices, x = dates, y = prices, title = 'Gold Prices over Time')
    fig.show()
    Packages (& Versions) used in this video:
    Pandas 1.3.2
    Plotly
    *****************************************************************
    Code from this tutorial and all my others can be found on my GitHub:
    github.com/Derrick-Sherrill/D...
    Check out my website:
    www.derricksherrill.com/
    If you liked the video - please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!!
    --- Channel FAQ --
    What text editor do you use?
    Atom - atom.io/
    What Equipment do you use to film videos?
    www.amazon.com/shop/derricksh...
    What editing software do you use?
    Adobe CC - www.adobe.com/creativecloud.html
    Premiere Pro for video editing
    Photoshop for images
    After Effects for animations
    Do I have any courses available?
    Yes & always working on more!
    www.udemy.com/user/derrick-sh...
    Where do I get my music?
    I get all my music from the copyright free TH-cam audio library
    th-cam.com/users/audiolibrary...
    Let me know if there's anything else you want answered!
    -------------------------
    Always looking for suggestions on what video to make next -- leave me a comment with your project! Happy Coding!
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 117

  • @yox82ify
    @yox82ify 3 ปีที่แล้ว +60

    Finally He remembered TH-cam password

    • @CodeWithDerrick
      @CodeWithDerrick  3 ปีที่แล้ว +4

      😂😂😂

    • @azamatsergaliyev1856
      @azamatsergaliyev1856 3 ปีที่แล้ว

      @@CodeWithDerrick Hi Derrick! Thanks for your videos, very helpful! Can you help me with the following problem: I have a csv file with 3 columns: date, expenses, and names of many different customers. I need to find the dates where customers spend more than 1 day before and 1 day after, as well as 1 week before and 1 week after. I think that datetime should help, but I don't know how to apply it in this problem.

    • @denniii09
      @denniii09 3 ปีที่แล้ว +1

      @@azamatsergaliyev1856 maybe try something with
      df[df["date"] == date.today()+X & df["date"] == date. today()-X] so like an conditional statement within your dataframe. Where X is your number 1 day or 7 days (1 week).
      Not quite sure about the notation for the datetime package right now

    • @py_tok5589
      @py_tok5589 3 ปีที่แล้ว +1

      no, Python has been missing him

  • @daksh_joshi11
    @daksh_joshi11 3 ปีที่แล้ว +4

    Man your channel deserves to blow up -- to-the-point, organised, clean and genuinely helpful videos. Thank you so much!!

  • @jarrodvos2347
    @jarrodvos2347 3 ปีที่แล้ว +6

    Thanks, Derrick! Looking forward to more advanced stuff explained in your usual clear and encouraging way. Great work.

  • @oscarsanchez3201
    @oscarsanchez3201 2 ปีที่แล้ว +1

    Hey I just wanted to say is that I have been binge watching your videos. In my opinion you have a gift for teaching please continue to make videos you provide tons of value. Thank you for everything!

  • @Edddaye
    @Edddaye 3 ปีที่แล้ว +2

    My man! your videos have been helping me understand pandas lib. Glad you're back!

  • @esquire9152
    @esquire9152 3 ปีที่แล้ว +5

    Happy you're back. I'm really in Python and glad to found your videos :)

  • @denniii09
    @denniii09 3 ปีที่แล้ว +4

    He's back! Excited for future advanced techniques from you ;)

  • @JR-ub3yv
    @JR-ub3yv 3 ปีที่แล้ว +1

    You are the man. The content, editing, and your adept teaching ability is exceptional. Thank you.

  • @angelreyes8256
    @angelreyes8256 3 ปีที่แล้ว

    I'm glad you are back, you are great at what you do!. It made me want to go back and continue to learn. Thanks Derrick

  • @lanelauhoff
    @lanelauhoff 3 ปีที่แล้ว +10

    Glad you're back!

  • @davidstone1826
    @davidstone1826 3 ปีที่แล้ว

    Welcome back!!! Awesome tutorial, Derrick.

  • @BoredSpaceRoo
    @BoredSpaceRoo 2 ปีที่แล้ว +1

    Derek, you legend. What an amazing intro to Pandas 🐼 Thank you so much kind ser! ☺️🙏✨

  • @gussta1
    @gussta1 3 ปีที่แล้ว

    Your short videos teach me more then videos 2 or 3 times as long. Great job...thanks.

  • @edsonwinnerify
    @edsonwinnerify 2 ปีที่แล้ว

    Thank you Derrick... keep your videos coming!

  • @alessandroscimone5463
    @alessandroscimone5463 2 ปีที่แล้ว

    Fantastic! Very well explained! Go Go go

  • @SG-xp3dh
    @SG-xp3dh ปีที่แล้ว

    Great work, Derrick! New sub!

  • @omarjanuyghur1093
    @omarjanuyghur1093 ปีที่แล้ว

    Oh my GOSH. this is the one I was looking for a long time, the best video of the month. Thanks for sharing this, very good explanation in very details. I can guarantee farmers or elementary school students also can understand your video, which is to the point, very simple and very clear.

  • @evelic
    @evelic ปีที่แล้ว

    Simple, clear to follow; great work.

  • @donald3884
    @donald3884 3 ปีที่แล้ว

    Glad to see you back

  • @livingiON
    @livingiON 2 ปีที่แล้ว

    Man, your explaining is on another level.

  • @jakke300
    @jakke300 ปีที่แล้ว

    Awesome Derrick, thank you

  • @philippecolin151
    @philippecolin151 3 ปีที่แล้ว +1

    My saviour! glad you are back... a 64 years old mini geek

  • @mahmoudgamal9835
    @mahmoudgamal9835 3 ปีที่แล้ว

    Great Job Derrick

  • @SvennoCammitis
    @SvennoCammitis 3 ปีที่แล้ว

    Nice vid! Pretty much what I need! Pls keep going!

  • @obiwan241
    @obiwan241 3 ปีที่แล้ว

    Simplemente, uno de los mejores. Gracias por tus aportes

  • @26d8
    @26d8 ปีที่แล้ว

    GOD, you answered all of my questions in 11 minutes. thank you

  • @richandrews4488
    @richandrews4488 3 ปีที่แล้ว +3

    Great stuff Derrick, thanks.
    I was wondering if at some point in this series you could show how how to read in a spreadsheet, filter it, and then write it back out as a spreadsheet but keep the same formatting as the original.
    I have figured out how to do everything except keeping the original formatting.
    Thanks.

  • @hoguerasconsidra
    @hoguerasconsidra 3 ปีที่แล้ว +1

    Your videos are amazing thanks a lot.
    Greetings from Spain :)

  • @shinstorm3473
    @shinstorm3473 5 หลายเดือนก่อน

    Loved your indepth walk through. Looking forward to another Pandas video 🍻 cheers

  • @tahirhanif9669
    @tahirhanif9669 2 ปีที่แล้ว

    Fantastic presentation, thanks for this!

  • @torque6389
    @torque6389 3 ปีที่แล้ว

    Love your tutorials!

  • @marcosscorzoni3465
    @marcosscorzoni3465 3 ปีที่แล้ว

    Great you are back!

  • @baz7915
    @baz7915 3 ปีที่แล้ว

    Please upload more, it’s so good haha

  • @Travlinmo
    @Travlinmo 2 ปีที่แล้ว

    Nice quick example. thanks.

  • @cordularaecke
    @cordularaecke 3 ปีที่แล้ว

    Welcome back! Good that you make more Pandas videos ... I refactored your code to include assign method - please do a video on this!
    import pandas as pd
    import plotly.express as px
    df = (pd.read_csv('inputs/monthly_csv.csv')
    .assign(Date=lambda x: x.Date.apply(pd.to_datetime),
    buy_price=lambda x: x.Price * .9))
    print(df.max(), '
    ')
    print(df.tail(3))
    fig = px.line(df, x='Date', y='Price', title='Gold prices over time')
    fig.show()

  • @applepie9806
    @applepie9806 2 ปีที่แล้ว

    I just found you and realised you hadn't posted for 10 months... 😭 pls come back, I'd gladly take your course if you have one to sell, the way you do things is simply brilliant.

  • @rynrbe3066
    @rynrbe3066 ปีที่แล้ว

    Thanks to your youtube videos, I am starting to use python for replacing some of my excel work that used to take a lot of time to do but once that script is ready, I can replicate it over and over again with a different project.

  • @gerv2079
    @gerv2079 2 ปีที่แล้ว

    Thanks for your explanations. All where useful to me. Greetings from Spain . ;)

  • @xKearnseyx
    @xKearnseyx 3 ปีที่แล้ว

    These videos have been a big help. Keep them coming. Maybe how to plot various smaller graphs at one html link?

  • @zzzgerardo
    @zzzgerardo 3 ปีที่แล้ว

    great video! thanks derrick.

  • @philip8232
    @philip8232 3 ปีที่แล้ว +2

    Thank you Derrick! I've changed job and now I work with data a lot more (all the time actually) and we work with Excel! Even though the data is quite big (couple tousand rows) so I'd love to kind of replace excel with Python while doing that. I know VBA and it helps, but Python would be a much better option for that! looking forward to new videos!

    • @mohansahu4286
      @mohansahu4286 3 ปีที่แล้ว

      If using excel is necessity use power query...else pandas is best

  • @AhmedAli-dz1hy
    @AhmedAli-dz1hy 3 ปีที่แล้ว

    Your videos are so helpful. Thanks a lot

  • @waleed5544
    @waleed5544 3 ปีที่แล้ว

    Really I'm waiting this event

  • @loveSG999
    @loveSG999 3 ปีที่แล้ว

    Hey Derrick, thanks for continuing to teach us Excel automation via python. Could you please at some point show us how to make such python Excel automation executable by those who aren’t tech savvy? I just had such a thought because I may need to roll out some of my python automation to my colleagues who don’t have python installed. It would be great for other end users to execute my python files without having to install and configure python on their PCs. Your guidance will be greatly appreciated 👍

  • @loveSG999
    @loveSG999 3 ปีที่แล้ว

    The python king is back 🤴👍

  • @LenaLena-ui1pk
    @LenaLena-ui1pk 3 ปีที่แล้ว

    this was so useful.

  • @bharatkumarjha9489
    @bharatkumarjha9489 3 ปีที่แล้ว

    Was waiting for your video from long time derrick. Could you please upload more on spreadsheet with examples

  • @bearsdj
    @bearsdj 3 ปีที่แล้ว

    tHANX A LOT...starting with pandas

  • @mint9121
    @mint9121 3 ปีที่แล้ว

    Super helpful!

  • @AHDN1964
    @AHDN1964 ปีที่แล้ว

    we miss you king

  • @rangabharath4253
    @rangabharath4253 3 ปีที่แล้ว

    awesome as always :-)

  • @khalidjj2073
    @khalidjj2073 3 ปีที่แล้ว

    Another awesome video...
    You make it so simple!
    How can you read a specific cell in csv file
    More videos please

  • @matheusosa
    @matheusosa 2 ปีที่แล้ว

    Thank you!!

  • @CurrentElectrical
    @CurrentElectrical 3 ปีที่แล้ว

    Welcome baaaAAAaack!

  • @001478
    @001478 3 ปีที่แล้ว

    Her Derrick, you are great ! Thanks for sharing your knowledge. I would appreciate it if you can teach how save the graph in the excel file. Thanks in advance

  • @TaxMentors
    @TaxMentors 3 ปีที่แล้ว

    Very nice well explained video

  • @akmiable
    @akmiable 3 ปีที่แล้ว

    Урааааа.... Деррик снова с нами!!!

  • @nikolaiberthelsen1739
    @nikolaiberthelsen1739 2 ปีที่แล้ว +1

    Please make more videos with Pandas! :)

  • @sekilasdakwah455
    @sekilasdakwah455 3 ปีที่แล้ว

    Hi sir,,,,,welcome back😊

  • @SnappyNat
    @SnappyNat ปีที่แล้ว

    Hi Derrick! You explain the concepts really well and I love your videos. The Excel series is great. I'm using Spyder instead of Kaggle and wasn't able to to get the plots to show in another window. Not sure what's up. I also copied and pasted your code to see if my code was just funky, but no. Of course I'm updating my Spyder and Anaconda through the Anaconda console while I'm working in Spyder so maybe that's it. Thanks bunches!

  • @naimurrahman3137
    @naimurrahman3137 3 ปีที่แล้ว

    Hey welcome back

  • @LAPOVETS
    @LAPOVETS 3 ปีที่แล้ว

    welcome back

  • @thisisbeka747
    @thisisbeka747 3 ปีที่แล้ว

    Yay, finally 😍

  • @TomMattle
    @TomMattle 3 ปีที่แล้ว

    I just discovered your videos and looked last night when your last post was and saw it was 6 months ago. Happy you’re back! Can you do a tutorial about how to concatenate data from multiple rows with the same identifier? For example if you have an order ID and sales amount and order type, let’s say Upsell, New, downgrade, etc. if I had 3 rows of data per transaction because a customer purchased 3 products, how could I create a new column that concatenates the order type so I can see if it is a New, Downgrade type of order?

    • @CodeWithDerrick
      @CodeWithDerrick  3 ปีที่แล้ว +1

      Thanks for the request! Just published a video on this case. Hopefully it helps!

    • @TomMattle
      @TomMattle 3 ปีที่แล้ว

      @@CodeWithDerrick thanks so much! I can’t wait to check it out!

  • @robertcliffort2354
    @robertcliffort2354 2 ปีที่แล้ว

    GREAT.

  • @rajmankar4440
    @rajmankar4440 3 ปีที่แล้ว

    brother you are really doing superb, try using jupyter notebook, it will be great to see instant output !

  • @StoltHD
    @StoltHD 3 ปีที่แล้ว

    Great video...
    Everyone else only makes videos with xml files without name spaced data...
    Can you make a video of how to get data from a XML file with namespace into panda ?
    without getting the namespace with the objects...

  • @temyraverdana6421
    @temyraverdana6421 3 ปีที่แล้ว

    Thanks, very useful for me. I have a question: background of the referenced chart?
    For example if I insert a background photo whose dimensions are known into the graph, I would like to measure the distance between the two points clicked by the mouse.
    Thanks

  • @HarmanSingh-jr2zo
    @HarmanSingh-jr2zo 3 ปีที่แล้ว

    long time no see

  • @martinmehaudy9043
    @martinmehaudy9043 8 หลายเดือนก่อน

    I'd love to see this as a series, moving into more complex subjects such as pivot tables and solver. Sadly, the latest video of the channel is over 2 years 🤷‍♂

  • @user-zl3rb8rr3t
    @user-zl3rb8rr3t 3 ปีที่แล้ว

    Cool!

  • @apz9022
    @apz9022 3 ปีที่แล้ว +1

    great intro... I am making the transition to python over the last few weeks. I am struggling to find equivalent functions I often used to manipulate data, such as left(text,4).. is there a resource anywhere that can explain the equivalent python panda code for these kind of functions. (This example is one I am searching for now and was how I came about this video)

  • @juanramirezmelo1389
    @juanramirezmelo1389 3 ปีที่แล้ว

    Could you show us how filter colums by users inputs?
    Thanks 👍

  • @randalljbeck
    @randalljbeck 2 ปีที่แล้ว

    Curious if you have or can show a video from start to finish that includes showing the excel files and how to save+run scripts after it's setup... Bringing the automation full circle ⭕ creation to finished results

  • @tyswenson7542
    @tyswenson7542 3 ปีที่แล้ว

    *For anyone wondering about the benefits of Pandas over excel. Once you have the data in a pandas data frame or series object, you unlock all of the other benefits of Python libraries as well. For example turning charts and graphs into daily PDF reports or sending yourself daily emails of info. The possibilities are endless compared to Excel.

  • @chervilfx7036
    @chervilfx7036 2 ปีที่แล้ว

    Thank you Derrick! Are there excel-python resource to dive deep research like pdf, ... ?

  • @FredyArg
    @FredyArg 3 ปีที่แล้ว

    i just found your channel, great content... can you help with reading an excel file in a document list in sharepoint online using pandas ?

  • @JourneyOfCricket
    @JourneyOfCricket 3 ปีที่แล้ว +1

    I have questions if I have a education df which is questions and options if I want to add chapter and topic based on questions how can I automated that task

  • @Hoopsgirlbp
    @Hoopsgirlbp 2 ปีที่แล้ว

    thank you Derrick for this video. The only part I had trouble was my figure never loaded in my browser. I researched and made sure javascript was enabled in chrome and still nothing. I saw another method which was writing to html and that worked just fine. Do you know why it won't open via show? Thanks

  • @gotbordercollies
    @gotbordercollies 3 ปีที่แล้ว

    Welcome back, but I can't seem to install pandas 😕

  • @sambagchi
    @sambagchi 2 ปีที่แล้ว

    Can you tell me how to load file who columns keep shifting everday as its created by user manually

  • @adrijanzareski470
    @adrijanzareski470 3 ปีที่แล้ว

    Can you make video for how to merge data from two columns based on text. For exapmle in first column you have: "20 tablets of 20mg" and in the second: "20 x 20mg". Thank you!

  • @aravindap464
    @aravindap464 2 ปีที่แล้ว

    I have been trying to read excel file to data frame based on user selecting the file. Tried all options like tkinter, easygui but no luck. Any suggestions or sample code?

  • @Santhosh_anandram
    @Santhosh_anandram 2 ปีที่แล้ว

    Could you please provide simple code for comparing two excels df’s and highlight the difference?

  • @arpsami7797
    @arpsami7797 3 ปีที่แล้ว

    Can you teach how to read excel files from a folder where there are bunch of others and just a date or special number are the key to read them. I am sure many people have to read excel files in a daily basis and do some jobs on each. Thank you

  • @deepakdakhore
    @deepakdakhore 3 ปีที่แล้ว

    Please show some small app in GUI like billing system

  • @theapexpredator157
    @theapexpredator157 2 ปีที่แล้ว

    How do you reference the excel file from OneDrive? - the syntax I mean.

  • @ntenzz1808
    @ntenzz1808 2 ปีที่แล้ว

    I knew we all here is ana advanced excel trying to use Python as a bridge to data analytics and big data for automate stuffs.

  • @ahmadalayed9155
    @ahmadalayed9155 2 ปีที่แล้ว

    How can i unmerge all the the sheet without choosing specific cells

  • @asifkhan-qr8tq
    @asifkhan-qr8tq 3 ปีที่แล้ว

    it was helpful but we actually need sending auto sms to our phone number after every data entered or every time we sale anything and type it in MS excel.

  • @frostz3307
    @frostz3307 3 ปีที่แล้ว

    Finally he hit a pole and remember his account password

  • @iisdw5033
    @iisdw5033 2 ปีที่แล้ว

    Hai derrick,
    Please help me
    If i have value in colum in sheet1, exp:
    No initial
    a21-100-103 ss
    a-100-107 dd
    b-100 cc
    And sheet2, i want to lookup value to get initial value from sheet1,
    Value in sheet 2 , exp
    No initial
    a21-102 ??
    a107 ??
    I can't get using vlookup or index and match,
    Could you make a code for that cause, please
    Oh, can i use phyton to access excel file in my pc using jupyter?
    Thanks a lot
    a21-103 ??

  • @ashishkharangate1110
    @ashishkharangate1110 2 ปีที่แล้ว

    Please give basic courses for beginners in using excel data in python some of the functions are too advanced for beginners

  • @Ready_Set_Boom
    @Ready_Set_Boom 2 ปีที่แล้ว

    I try something similar and it says px is not defined.

  • @GASP2.0
    @GASP2.0 3 ปีที่แล้ว

    Bro please make tutorial video for spreadsheet App Script

  • @lyricsdelivered
    @lyricsdelivered 2 ปีที่แล้ว

    How to add a column into a list in python?

    • @CodingIsFun
      @CodingIsFun 2 ปีที่แล้ว

      Here is an example for you:
      import pandas as pd
      df = pd.read_csv("raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv")
      tips_column = df['tip']
      tips_column_as_list = tips_column.to_list()
      print(tips_column_as_list)
      I hope it helps!

  • @vinitkatariya2585
    @vinitkatariya2585 2 ปีที่แล้ว

    Why dont you use Jupyter Notebooks? It's more convenient as you don't have to rerun the whole program.

  • @Gab8riel
    @Gab8riel 3 ปีที่แล้ว

    Algorithm I summon you

  • @py_tok5589
    @py_tok5589 3 ปีที่แล้ว +1

    Python rules

  • @Agnotke
    @Agnotke 3 ปีที่แล้ว

    Where we u man