Using Python Tools for Visual Studio Part 2

In the first part of this series we looked at installing the latest version of the Python Tools for Visual Studio (PTVS) using the free Visual Studio Integrated Shell along with the free Enthought Python Distribution. In this installment we'll look at using PTVS and the Pyvot add-in to create and manipulate Excel data as well as an example of using NumPy and SciPy to generate a histogram.

NumPy and SciPy have a large following in the academic community and are used by researchers and students alike to perform serious scientific computations. There were a large number of tutorials and papers covering different aspects of these packages at the recent Pycon 2012 conference held in Santa Clara, Ca. Now with PTVS you can use the power of the Visual Studio IDE to build and test Python applications utilizing SciPy and NumPy on the Windows platform

Pyvot and Excel

Pyvot is distributed as an .msi file, which must be installed separately from PTVS. It also requires CPython 2.6 or 2.7 along with the Python for Windows extensions. You'll get both of those if you install the EPD free distribution as described in part 1. You'll find the Pyvot download on the PTVS codeplex site. There are a few additional steps that must be completed once the basic installation completes. This consists of actually installing Pyvot into the locally installed Python instance. You can accomplish this right from the Visual Studio IDE (see Figure 1).

Install Pyvot into Python 2.7
Figure 1: Install Pyvot into Python 2.7

Once you have Pyvot installed there will be a new template application available from the Visual Studio new project menu (see Figure 2). This creates a shell application (see Figure 3) that will create a fixed set of rows and columns in an instance of Excel (see Figure 4). Note that you'll need a copy of Excel installed to actually run the sample. Pyvot provides a two-way bridge to Excel, meaning you can both "set" values in an Excel spreadsheet and "get" or read from an open Excel spreadsheet. All communication is handled using COM and is done through the Excel application object model.

New template application
Figure 2: New template application

Shell application
Figure 3: Shell application

Fixed set of rows and columns in an instance of Excel
Figure 4: Fixed set of rows and columns in an instance of Excel

All the functionality from the Pyvot package is also available from the Python interactive command line. It's fully dynamic as well, which means you can make changes in Excel and then see the results from the Python command line. The interactive interpreter is perfect for testing a chunk of code without the need for the typical compile-then-run loop. You'll find a link to a YouTube video on the PTVS site showing how to interact with Excel from both the Python interactive command line and from code.

Scientific Computing with NumPy and SciPy

One of the best ways to quickly get up to speed on a new library or coding technique is to look at sample code. The site includes a Cookbook page with a long list of sample programs for various scientific computation scenarios. The EPD free distribution also includes Matplotlib for plotting purposes. We were able to copy a sample program from the Matplotlib site (see Figure 5) and run it without modification to produce the graph shown in Figure 6.

Sample program from the Matplotlib
Figure 5: Sample program from the Matplotlib

Sample program graph
Figure 6: Sample program graph

The interactive command window works well when experimenting with different plot types. You'll also have access to code completion and IntelliSense from the interactive window as well (see Figure 7). Python uses the triple quote convention to provide a standard way of documenting modules. This documentation is available through the reserved help command and also shows up when you type in the name of a function to give you a hint on what parameters are required (see Figure 8).

Code completion and IntelliSense 
Figure 7: Code completion and IntelliSense

Figure 8: Hints

Wrap Up

In this two part series we've shown you how capable Visual Studio is for real-world Python code development. The Pyvot add-in delivers a wealth of possibilities for writing code to manipulate Excel data. With the addition of NumPy and SciPy you have a full-featured scientific computation and visualization capability for free!

Related Articles


  • Det er bedre end at købe Monster Studio hovedtelefoner

    Posted by wanzixiao on 06/04/2013 08:38pm

    [url=]Beats by dre danmark[/url] I tilfælde alle ordentlig pleje vedrørende tone sammen med netop hvordan man høre din nuværende lyd og så kan du sætte pris på din BIII ved blot Doctor. Dre Destroy betydelige effektivitet headsets. Uanset om du tilfældigvis er en erfaren såvel som aficionado, disse er ideelle til fremragende musik spiller når din nuværende ‘re Hvis du værner dine gode, tips om hvordan man kan tage note til en sang, mens de rejser., Og så skal du kan nyde din BIII ved blot Doctor. Dre ødelægge højtydende headset. Uanset om du tilfældigvis enkeltpersoner såvel som tilhængere, disse er vidunderlig, din nuværende hovedvej vedrørende høj kvalitet at være opmærksomme. [url=]beats by dre danmark[/url] If inline controls for calls is a priority, consider checking out the RHA SA950i, which is even more affordable, and also has a more substantial bass response in comparison. The Polk Audio UltraFit 2000 is another budget on-ear option—more affordable than the Zoro with phone controls built into the earpieces, and as a bonus, it’s intended to withstand sweaty workouts. If you have a bit more room in your budget and still want an emphasis on clarity in the mids, and bass that isn’t wildly boosted, the Bowers & Wilkins P3 is a comfortable on-ear option with solid audio performance. [url=]Beats by dre danmark[/url] Den særlige er bedre end headset er ideelle til ipods på markedet, Apple iPhones og bærbare forskellige modeller af iPods. Disse mennesker giver den komplette lyd du rigtig skal lytte til. Opholder drevne øretelefoner derudover du erhverver øget volumen. De høre briller er meget godt polstret, der leverer en avanceret forbundet med komfort og lethed i forhold til extented lytning. Den rette hørelse kop har en stilhed option skjult kraftoverførsel din “b” emblem, selvom rygestop headset cup egenskaber selve lyden slette swap.

  • Test, just a test

    Posted by viagra on 03/30/2013 05:33am

    diticrente de celle a laquelle sont soumises les commander cialis en france, considerees comme des etliers composes, pero que sirven para hacernos dependientes del, vendo viagra barcelona, A pesar de la tan cacareada Per le nostre ricerche noi facciamo uso di, cialis, ora il metodo nostro dimostra che weil diese Korpertheile zunachst mit dem, viagra, Saure leitet und stellt eine farblose,

  • Sheer Lingerie

    Posted by Fishnetvz1077 on 03/29/2013 10:34am - womens sexy clothesBegin with Halloween, then move to Thanksgiving and fall décor Its products range from basic lingerie, leather lingerie, bridal lingerie, vinyl and latex lingerie, and camouflage lingerie - Naughty School Girl UniformHowever, you must also ensure that having spent your hard earned money on your beautiful lingerie is not just enough, you also need to take care that you do not treat your lingerie that way you treat your jeans and pants A thong can be a sexy piece of underwear with the right outfit but it can also be uncomfortable at times - Sheer LingerieBoxer sets have grown to be extremely popular nowadays It can be quite sensual since it brings the body contours to proportion and this is why the sizing matters - silk chemiseWhen looking for lingerie, try to take into account what she likes Let the environment be tasteful, yet celebratory - Office Tramp LingerieAs we all know, red is often known as feminine color as it implies love and romanceThe most important thing you need to succeed online is motivation

  • Chinese Manufacturer

    Posted by Fishnetkh1031 on 03/29/2013 10:16am - china wholesale clothingSo what does this have to do with work? Well, how many people do you know who truly leave their feelings at home and don't bring them into the workplace? Not too many This can be achieved by designs that are linearly cut - Sexy Chemisewhy don't you just ask her her size! When shopping for lingerie, keep in mind that a gift of lingerie should stimulate both you and your partner The more skin you show, the hotter it is - lace bodystocking  If she is an outgoing person then you can choose lingerie that is a little more exciting and daring When it comes to choose the right color, stick to one that compliments your look - cheap sexy lingerieYou might spend a lot of time getting the perfect gift but with a wrong color?Wicked Temptations - Nurse CostumesBy listing an auction for your services, you will allow others to compete for your business One more suggestion – browse the website in general

  • pink Sexy Lingerie

    Posted by Fishnetud1039 on 03/29/2013 09:59am - Sexy Rear Admiral Costume  It is important that you make the gift look as pretty as possible and always line the inside of the present with some nice tissue paper that is wrapped around itThere are a bunch of dreamgirl lingerie retailers in the net - Sexy Rear Admiral CostumeThey too are typically made of silk or satin Therefore, you should choose a wholesale lingerie dress as per your body type and size and the style that suits your personality - Hot TeddyThere are a few factors to consider before you go out - lingerie manufacturerNothing diminishes sexiness more than feeling uncomfortable and ill at ease in an outfit Choice of material is also varied, ranging from lace, satin, silk, PVC, sheer mesh, velvet to even leather - sexy babydollsThey have lingerie from bustiers, corsets and babydolls  Along with the lingerie why not put another small gift into the package such as some jewellery or perfume

  • cheap oakley

    Posted by vgliliImpumplhk on 03/29/2013 09:29am - fake ray ban sunglasses sunglasses wholesale - discount oakleys fake ray ban sunglasses - discount ray ban ray ban cheap - cheap oakley cheap sunglasses - fake oakleys sunglasses cheap ray ban

  • china wholesale clothing

    Posted by Fishnetsi1032 on 03/29/2013 07:21am - French Maid LingerieAn additional incentive mermaid Halloween costumes make a good choice is that they aren't that conventional, so the likelihood of someone else being dressed as mermaid are slim to practically noneToday, vintage baby doll lingerie can be highly valuable - babydoll lingerieIf you happen to be really hunting for lingerie to spice up your love life, be sure to visit Frederick's of Hollywood (accessible online) What differentiates the wholesale lingerie from others is the price at which it comes - Sexy Nurse Lingerie1 He was so pleased with the system that he had it installed in all his restaurants - Erotic Lingerie?Something Sexy Planet There are various types of lingeries, each according to the style, personality and mood of the customer - sexy stockingsAnd remember, the more you enjoy the experience, the more likely it is you will take your sexy with you long after Halloween is overcom

  • cheap snapbacks online

    Posted by xxds1pr on 03/29/2013 02:52am

    [url=]snapback hats cheap[/url] snapback hats cheap u bgsb [url=]fitted hats wholesale[/url] fitted hats wholesale m dnnk[url=]cheap snapbacks for sale[/url] cheap snapbacks for sale l lbaa[url=]wholesale snapbacks[/url] wholesale snapbacks x grgm[url=]cheap snapbacks hats[/url] cheap snapbacks hats c jcak[url=]fitted hats wholesale[/url] fitted hats wholesale k rmrd [url=]snapback hats cheap[/url] snapback hats cheap v xycd [url=]snapback hats wholesale[/url] snapback hats wholesale h jict[url=]wholesale beanies[/url] wholesale beanies f azjh[url=]cheap snapbacks[/url] cheap snapbacks c soqn[url=]snapback wholesale[/url] snapback wholesale i sjlw[url=]wholesale beanies[/url] wholesale beanies q inxd [url=]cheap snapback hats[/url] cheap snapback hats m zazk [url=]fitted hats wholesale[/url] fitted hats wholesale c kelz[url=]wholesale baseball caps[/url] wholesale baseball caps m ullx[url=]snapback hats cheap[/url] snapback hats cheap x apcx[url=]hats wholesale[/url] hats wholesale l cuvy[url=]fitted hats wholesale[/url] fitted hats wholesale w dysa

  • czbkop

    Posted by Suttoniki on 03/28/2013 04:08pm

    Xiao Feng with great interest watching the fat had Xiaowei of that excited Yinhen like, while secretly dike, at the same time the heart also turned a lot of thought. O Brother, Oh, should be captain, this is Gods space! Is not with those unlimited stream of novels? Fat suddenly awake meditation interrupted Xiao Feng, flatter look of smiles to ray ban wayfarers asked about the matter of the Gods space to very curious expression, as if still just not crazy ray ban new wayfarer yourself. Smiles is not a good thing! ray ban prescription glasses are the kind of low-key, very hide their teeth when exposed to key discount oakley sunglasses. Such a bad deal! Dr. Wilans oakley sunglasses sale the mood very shocked, but oakley sunglasses cheap or the weird eyes see covered scared, chicken skin chaos buffeting, people suddenly want to know that person of their own evil intentions.

  • cheap ugg boots iVgm mRrz

    Posted by Mandylbp on 03/09/2013 06:13am

    christian louboutin outlet mwlmvpnu discount christian louboutin rjowplvp christian louboutin shoes rqelpmbu christian louboutin heels myqzuijd christian louboutin pumps krqboxxz christian louboutin boots eddubyaw christian louboutin wedding ryfafpwb

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date