background preloader


Facebook Twitter

Jupyter Notebook Viewer. Pandas Pivot Table Explained - Practical Business Python. Introduction Most people likely have experience with pivot tables in Excel.

Pandas Pivot Table Explained - Practical Business Python

Pandas provides a similar function called (appropriately enough) pivot_table . While it is exceedingly useful, I frequently find myself struggling to remember how to use the syntax to format the output for my needs. This article will focus on explaining the pandas pivot_table function and how to use it for your data analysis. If you are not familiar with the concept, wikipedia explains it in high level terms. As an added bonus, I’ve created a simple cheat sheet that summarizes the pivot_table. The Data One of the challenges with using the panda’s pivot_table is making sure you understand your data and what questions you are trying to answer with the pivot table. In this scenario, I’m going to be tracking a sales pipeline (also called funnel). Typical questions include: How much revenue is in the pipeline?

Many companies will have CRM tools or other software that sales uses to track the process. Read in the data. Beautiful Soup Documentation — Beautiful Soup 4.2.0 documentation. Beautiful Soup is a Python library for pulling data out of HTML and XML files.

Beautiful Soup Documentation — Beautiful Soup 4.2.0 documentation

It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree. It commonly saves programmers hours or days of work. These instructions illustrate all major features of Beautiful Soup 4, with examples. I show you what the library is good for, how it works, how to use it, how to make it do what you want, and what to do when it violates your expectations. The examples in this documentation should work the same way in Python 2.7 and Python 3.2. You might be looking for the documentation for Beautiful Soup 3. This documentation has been translated into other languages by Beautiful Soup users: 这篇文档当然还有中文版.このページは日本語で利用できます(外部リンク)이 문서는 한국어 번역도 가능합니다. Here’s an HTML document I’ll be using as an example throughout this document. Here are some simple ways to navigate that data structure: One common task is extracting all the URLs found within a page’s <a> tags: Tag.

DataScienceSpecialization/courses. 10-minute tour of pandas. Python Lists - Google for Education. Python has a great built-in list type named "list".

Python Lists - Google for Education

List literals are written within square brackets [ ]. Lists work similarly to strings -- use the len() function and square brackets [ ] to access data, with the first element at index 0. (See the official list docs.) colors = ['red', 'blue', 'green'] print colors[0] ## red print colors[2] ## green print len(colors) ## 3 Assignment with an = on lists does not make a copy.

B = colors ## Does not copy the list The "empty list" is just an empty pair of brackets [ ]. FOR and IN Python's *for* and *in* constructs are extremely useful, and the first use of them we'll see is with lists. Squares = [1, 4, 9, 16] sum = 0 for num in squares: sum += num print sum ## 30 If you know what sort of thing is in the list, use a variable name in the loop that captures that information such as "num", or "name", or "url".

List = ['larry', 'curly', 'moe'] if 'curly' in list: print 'yay' You can also use for/in to work on a string. Range. Python Boot Camp. The BootCamp has wrapped up ... if you took the bootcamp please give us feedback.

Python Boot Camp

We took over all the Brower Center! This is the main site for the Python Boot Camp Fall 2013, at the Brower Center (2150 Allston Way) near the UC Berkeley Campus from August 26 (Monday) to August 28 (Wednesday) 2013. The purpose of the boot camp is to get those familiar with other computing languages (like C, Java, FORTRAN, and Lisp) ramped on the basics of the Python language. This is not a computer science class; understanding of basic CS concepts (like looping, recursion, pointers, etc.) are presupposed. The Boot Camp itself is a mixture of formal lectures, in-class demos, coding breakout sessions for participants, and homework projects.