background preloader

Python Excel

Python Excel
Related:  Ladies Learning CodePython

Manipulating Excel files using Python part 2: Writing Excel Files | Michalis Avraam Writing Excel files using Python is quite easy, using the xlwt package. Similar to xlrd mentioned in an earlier post, xlwt allows one to write Excel files from scratch using Python. A brief reminded of Excel files (as mentioned in an earlier post) follows, to help people understand how Excel files work.The program stores data in what is called a Workbook. Think of this as the file on your computer (the .xls). A Workbook can then have one or more Sheets, the little tabs on the bottom left corner usually. And that is all you need. (1 votes, average: 5.00 out of 5) Loading ... Related posts:

How to create Windows executable (.exe) from Python script Python is a simple and powerful language for scripting and even application development. Various GUI packages available for Python makes it suitable for developing full fledged applications in python. Ok that is fine, but ever thought of creating an executable file from the python script you wrote? Introduction Python is a simple and powerful language for scripting and even application development. This tutorial will give step by step instruction on how to create Win32 executable from Python script. Python. A console application The following code prints a header and numbers 1 to 10 to console output. Save this code in to (or any name with .py extension) file. Our Python script is ready. The code is simple and straight forward. Building the executable is finished. A GUI Application We have successfully created a console application executable from a Python script. Create a new file paste the following code and save it with name "". So far so good.. Downloads

Python : lire et écrire des fichiers Microsoft Excel, application à Quantum GIS S'il y a une question récurrente sur les forums SIG, c'est comment traiter des données contenues dans des fichiers Microsoft Excel dans des SIGs comme Quantum GIS et autres (voir par exemple Jusqu'à peu, les utilisateurs de Windows étaient favorisés car le module Pywin (qui utilise com) pouvait être utilisé pour cette tâche (voir « Python for Windows, Ressources and examples », par exemple). Rien pour les autres... Heureusement, deux modules « universels » sont sortis , xlrd pour lire les données et xlwt pour écrire des données (classeur, feuilles etc.). lecture d'un fichier Excel création d'un fichier Excel Principes Les modules sont basés sur la documentation d'OpenOffice sur le format des fichiers Microsoft Excel ( ) et sont écrits en pur Python, c'est-à-dire disponibles pour toutes les plateformes. Pour aller plus loin avec Quantum Gis couche Excel dans Quantum GIS

Hello, World! - Learn Python - Free Interactive Python Tutorial Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the "print" directive - it simply prints out a line (and also includes a newline, unlike in C). There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 2, because it is more widely used and supported. For example, one difference between Python 2 and 3 is the print statement. To print a string, just write: print "This line will be printed." Execute Code Indentation Python uses indentation for blocks, instead of curly braces. x = 1 if x == 1: # indented four spaces print "x is 1." Use the "print" command to print the line "Hello, World!".

Creating Excel Files with Python and Django — Introduction When a client needs to manipulate data, it's easiest to give them an Excel spreadsheet. Creating a spreadsheet is easy with Python, and making it available for web download is just as easy with the Django web framework. After a brief tangent into evolutionary history, you'll find out how to do both. Sharks haven't evolved much in millions of years, mostly because they're wildly efficient. Much like sharks, spreadsheets haven't evolved much in the past few decades. Given the efficiency of spreadsheets, sometimes it pays to acknowledge their power, and not waste your time trying to improve on it. It's rare to find a client that knows exactly how they want to manipulate the data you're going to be presenting to them. This isn't some flaw in a product owner's mind; rather, it's a direct result of their probably never having actually seen all the data in one place before. Given the above, whenever possible, I like to give a product owner an Excel representation of their data.

Manipulating Excel files using Python part 1: Reading Excel Files | Michalis Avraam It is often the case that the freely available data online are in Excel format. If one has Excel, then one has the ability to do some sort of basic manipulation of the files. But if Excel is not available, or your analysis software does not read Excel files, there is another way: use Python to manipulate Excel files. Before continuing, let’s discuss the basic idea of Excel. This programs stores data in what is called a Workbook. In order to read Excel sheets in Python without using any Microsoft Office code, we need to use the excellent xlrd packge by Lingfo. The basic idea is very simple, and we can easily write a little Python script that will allow us to read Excel files without the need to use Excel itself. That is all there is to it. (3 votes, average: 4.00 out of 5) Loading ... Related posts:

My Experiences as a Female Software Engineer | Jean Hsu It’s no secret that females in Computer Science, both in academia and industry, are scarce. While the percentage of females in other male-dominated fields has been on the rise, that of females majoring in computer science has been on a downward spiral in the past few decades, currently sitting at about 12% to 20%. When I was at Princeton, it was on the lower end, with the class of 2007 having 2 women out of about 20, and the class of 2008 having about 5 out of 50. I don’t claim to know why the numbers are so low, though I think much of it has to do with the culture of Computer Science and the type of people that go into the field. In high school, I took two computer science courses– Intro to Computer Science using C++, and AP Computer Science. Despite my own pre-college experience with Computer Science, it was not an obvious choice for me. Most of my classmates were not that extreme, and from my experience, most mean well but are just socially awkward. Related posts:

Sauvegarde de données avec Python et le module csv CSV, ou Comma-separated values , est un format informatique ouvert représentant des données tabulaires sous forme de valeurs séparées par des virgules. (Définition de Wikipédia). Séparé par des virgules, ou tout autre caractère choisis d’avance en pratique, avec Python . Ce format à l’avantage de stocker des données simplement, sans forcément avoir recours à une base de données tel que sqlite3 par exemple. Les données étant stocké en texte clair, elles sont récupérable par tout autre scripts et langages, par exemple pour générer des graphiques après. Python offre un module de base simple pour faire cela. Stocker des tableaux import csv #Un tableau: prénom, âge data = [ [ 'paul' , 42 ] , [ 'nico' , 31 ] , [ 'jack' , 22 ] #On écrit dans le fichier with open ( 'test.csv' , 'w' ) as f: writer = csv . writer ( f ) writer. writerows ( data ) #On lit dans le fichier with open ( 'test.csv' , 'r' ) as f: reader = csv . reader ( f ) for i in reader: print i $ . [ 'paul' , '42' ] [ 'nico' , '31' ] [ 'jack' , '22' ]

Related:  Pythonmodule's