Pandas Basics – p.2 Data Analysis with Python and Pandas Tutorial

///Pandas Basics – p.2 Data Analysis with Python and Pandas Tutorial

Pandas Basics – p.2 Data Analysis with Python and Pandas Tutorial

FavoriteLoadingAdd to favorites

In this Data analysis with Python and Pandas tutorial, we’re going to clear some of the Pandas basics. Data prior to being loaded into a Pandas Dataframe can take multiple forms, but generally it needs to be a dataset that can form to rows and columns.

Text-version and sample code for this tutorial: http://pythonprogramming.net/basics-data-analysis-python-pandas-tutorial/

Python dictionaries tutorial: http://pythonprogramming.net/dictionaries-tutorial-python-3/

http://pythonprogramming.net
https://twitter.com/sentdex

By |2017-05-01T12:20:41+00:00April 26th, 2017|Programming Video Tutorials, Python Video Tutorials|50 Comments

50 Comments

  1. Magnum Magnanimo April 26, 2017 at 9:27 pm - Reply

    hey why use double brackets with the two colluns?

  2. Alireza Pakdaman April 26, 2017 at 9:27 pm - Reply

    what is —> style.use(‘ggplot’) ?

  3. MrBigmit37 April 26, 2017 at 9:30 pm - Reply

    Great Video. I’m having a little trouble with an error:
    module ‘pandas’ has no attribute ‘DataFrame’

    This is what I have so far:

    import pandas as pd

    web_stats= {xxxxxxxx}

    df = pd.DataFrame (web_stats)
    print(df)

    What am I doing wrong?

  4. Arjunkumar K K April 26, 2017 at 9:31 pm - Reply

    Nice presentation! Thanks you sharing awesomeness!

  5. Sameer Dubey April 26, 2017 at 9:32 pm - Reply

    Doing great!. Really good one. Just one thing I want to ask what other attributes, functions and members of pandas besides the ones you’ve taught in the series should I go through to get a handle more complex data sets. I mean if only you can give me a blunt list, Ill be glad.

  6. heming cai April 26, 2017 at 9:32 pm - Reply

    df=pd.DataFrame(web_stats)
    # df.set_index(‘day’, inplace=True)
    df2=df.set_index("day",inplace=True)
    print(df2.head())

    hi,if i type the above df2=df.set_index("day",inplace=True) ,i will get the error like AttributeError: ‘NoneType’ object has no attribute ‘head’
    but if i type df.set_index(‘day’, inplace=True) , it will be fine.

    can you tell me why?

  7. Srikanth Chiravuri April 26, 2017 at 9:33 pm - Reply

    When I hit F5, my Python module closes immediately after running. How do I prevent that? Currently, I’m just using "import os os.system(‘pause’)

  8. Sunny Beta April 26, 2017 at 9:36 pm - Reply

    So many doubts were clarified and this is just part 2 :p

  9. Mohammad Samiul Islam April 26, 2017 at 9:38 pm - Reply

    df.set_index() -> slap in the face ๐Ÿ™

  10. Gangi reddy April 26, 2017 at 9:39 pm - Reply

    HI Guys,

    I am very new to the pyhton coding,
    After Running the below code:

    import pandas as pd
    import pandas.io.data as web
    import matplotlib.pyplot as plt
    from matplotlib import style
    style.use(‘ggplot’)

    web_states = {‘Day’:[1,2,3,4,5,6],
    ‘Visitors’: [43,53,46,78,88,24],
    ‘BounceRates’:[65,74,99,98,45]}
    df= pd.DataFrame(web_states)

    pritn(df)

    Im getting error as

    Traceback (most recent call last):
    File "C:/Users/KARTIK/Desktop/gangi/python/date.py", line 1, in <module>
    import pandas as pd
    File "C:UsersPython36-32libsite-packagespandas__init__.py", line 13, in <module>
    __import__(dependency)
    File "C:UsersPython36-32libsite-packagesnumpy__init__.py", line 142, in <module>
    from . import add_newdocs
    File "C:UsersPython36-32libsite-packagesnumpyadd_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
    File "C:UsersPython36-32libsite-packagesnumpylib__init__.py", line 8, in <module>
    from .type_check import *
    File "C:UsersPython36-32libsite-packagesnumpylibtype_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
    File "C:UsersPython36-32libsite-packagesnumpycore__init__.py", line 16, in <module>
    from . import multiarray
    SystemError: initialization of multiarray raised unreported exception

    Can some help me on this,
    Thank you

  11. Awara Amin April 26, 2017 at 9:41 pm - Reply

    Great great and one more time great you are!

  12. ๅฎๆฐๆŽ April 26, 2017 at 9:42 pm - Reply

    cannot find any video better than this

  13. Liam Whan April 26, 2017 at 9:42 pm - Reply

    +1 for not being a fan of IPython Notebooks and not really knowing why

  14. Paul Brandt April 26, 2017 at 9:42 pm - Reply

    I noticed that after you used df.set_index(‘Day’, inplace=True) the day index only goes to 5 instead of 6, how can that be fixed? I added one more entry to all three entry’s and it still only goes to 5, what’s up????

  15. ้™ˆๆ…Ž่ฟœ April 26, 2017 at 9:44 pm - Reply

    Good work, just one thing, I think the voice is too light and do not works well. Maybe a better microphone are needed.

  16. KradolfusdePedoclown April 26, 2017 at 9:44 pm - Reply

    You’re amazing, especially with combining these YouTube videos with the your website where you can find the code you use. Would totally recommend this, thank you, thank you, thank you:))))))

  17. Ali Mizan April 26, 2017 at 9:46 pm - Reply

    This, and the newboston are my go to places to learn stuff that I end up using for both school and work. Thanks for the work you put into these videos, it’s appreciated.

  18. Justice Gwatidzo April 26, 2017 at 9:47 pm - Reply

    man u r great

  19. Rui Xue April 26, 2017 at 9:47 pm - Reply

    5:55 index of pandas

  20. Arpan Shah April 26, 2017 at 9:49 pm - Reply

    Thank you so much for providing this videos.! They are really helpful specially to newbie in respective fields.

  21. Ulyses Rico Rea April 26, 2017 at 9:49 pm - Reply

    Hello, first of all let me tell you , you explain terrific! I have a great doubt. I’m very new to this topics and I’m being asked to retrieve information from txt files and from that calculate TF-IDF, Boolean matrix, term document matrix, similitude measures (cosine, etc) and plot all that. I chose python because I was told it has several tools which make it easy, do you have any material or cookbook for that? Or maybe a guide? Thanks!!!

  22. anusha chowdary kommineni April 26, 2017 at 9:50 pm - Reply

    hi,can we convert pandas dataframes to url?

  23. Shivam Gupta April 26, 2017 at 9:52 pm - Reply

    How to read/write CSV or excel files

  24. Fiona W April 26, 2017 at 9:52 pm - Reply

    How can I remove the index as labeled.

  25. Roman Vidrevich April 26, 2017 at 9:52 pm - Reply

    when you print a single column from a data frame you have set with an index, would it not return the column along with the index? great video btw!

  26. Ronald Joosten April 26, 2017 at 9:54 pm - Reply

    in the new python version you have to install pandas-datareader
    pip install pandas-datareader.

    #import pandas-datareader as web
    import pandas_datareader as pdr

    if you use that it will work.

  27. Muhittin Kaplan April 26, 2017 at 9:54 pm - Reply

    yes i think too, you are great.

  28. Hankyol Lee April 26, 2017 at 9:54 pm - Reply

    I like his content, but I’m lost because he doesn’t announce what he will be covering in the lecture at the beginning.

  29. jyo April 26, 2017 at 9:56 pm - Reply

    I got as Templatedoesnot exitsat/.Can you please help me out

  30. Ajay Mishra April 26, 2017 at 9:57 pm - Reply

    This is too good

  31. xuepeng cao April 26, 2017 at 9:58 pm - Reply

    Happy to share

  32. SeanChannel April 26, 2017 at 9:59 pm - Reply

    Thank you bro i am keep learning your tutorials Thanks

  33. Priyanka Vasudevan April 26, 2017 at 9:59 pm - Reply

    This is extremely useful. Thank you.

  34. Graham Root April 26, 2017 at 9:59 pm - Reply

    When I run the code, I get the error " ‘module’ object has no attribute ‘dataframe’ "
    What can I do to fix this error?

  35. photinoman April 26, 2017 at 9:59 pm - Reply

    Great videos! Subscribed!
    lets day I have:
    ……
    df.plot()
    plt.show()

    This doesn’t show anything using terminal or an IDE, but when I run the code in Ipython, I can see my plot. This is pretty annoying. I also don’t like Ipythonย btw. Pycharm is great!

  36. freanchie utkarsh April 26, 2017 at 10:00 pm - Reply

    you are absolutely costing millions to udemy treehouse etc.. keep it up

  37. Carlos Romero April 26, 2017 at 10:06 pm - Reply

    great work!

  38. rshrott April 26, 2017 at 10:09 pm - Reply

    Excellent videos

  39. Aswin Gigi April 26, 2017 at 10:13 pm - Reply

    Is there an easy way to distinguish or identify commands that modify the dataframe or don’t modify it by default rather than printing or checking every time?
    Also I loved the video, thanks!

  40. Shyama Sonti April 26, 2017 at 10:14 pm - Reply

    Hi, you "import matplotlib.pyplt as plt" then you have "from matplotlib import style". When do you start with "import" and "from". Sorry if it is a naive question but could not get a good answer just googling.

  41. sad zizou April 26, 2017 at 10:15 pm - Reply

    i have python 3.5 .but this test = pd.DataFrame(web_stats)
    doesn’t work with me. why?

  42. Nishant Porwal April 26, 2017 at 10:15 pm - Reply

    hi i have been successfully runned the code as it was described my question is the code runs TRUE for both these statements
    1. df.set_index(‘Day’, inplace=True)
    2. df.set_index(‘Day’, inplace=’True’)
    in 1. we have true without any apostrophes while in second one we have True as a string by use of apostrophes

  43. Tiwari Trishula April 26, 2017 at 10:16 pm - Reply

    This one is so cool ๐Ÿ™‚ thanks

  44. Amin Nazari April 26, 2017 at 10:16 pm - Reply

    great job! thanks mate!

  45. Christopher Forte April 26, 2017 at 10:16 pm - Reply

    Instead of using a second line to set the index to ‘Day’ would it be good practice to do it from the start with:

    df = pd.DataFrame(web_stats).set_index(‘Day’)

    Or is it generally a better idea to separate it out as you did? Thanks, you have some great videos

  46. JSA19882007 April 26, 2017 at 10:20 pm - Reply

    I am using python3.6, this doesn’t work I think. It gives a bunch of errors in the modules

  47. Leonardo Leano April 26, 2017 at 10:21 pm - Reply

    You shoud try in ipython:

    $ %run <file name>

    It would bring you some confort.

  48. Hellen Lai April 26, 2017 at 10:21 pm - Reply

    when i key print(df[[‘Visitors’,’Bounce Rate’]]). It shows KeyError: "[‘Bounce Rate’] not in index". I am using python 2.7. May I know what might be the reason caused this?

  49. Lee K April 26, 2017 at 10:22 pm - Reply

    thank you for making these useful videos!

  50. Dashboard Executive April 26, 2017 at 10:25 pm - Reply

    Really enjoy hitting the like button! Great work!

Leave A Comment

*