Re: [Tutor] Hello Python Tutor - help please!
On 22/08/12 21:51, Cecilia Chavana-Bryant wrote: def main(fname, sheet_name): wb = xlrd.open_workbook(fname) sh = wb.sheet_by_name(sheet_name) data1 = sh.col_values(0) data2 = sh.col_values(1) return data1, data2 fname = "Cal_File_P17.xlsx" sheet_name = "RefPanelData" (data1, data2) = main(fname) print data1, data2 ... I do not know where the data is being saved to. That's because it isn't being saved anywhere, it gets thrown away after printing it. If you want to save it you need to augment/replace the print statement with a file write statement(s) You could also write it out using the OS redirection facility. On Unix (ie Your MacOS Terminal) thats done by running the program like: $ python myprog.py > myOutputFile.txt Where you substitute your own desired program name and output filename of course! But that will just create a text file that looks like the output displayed on the Terminal, which is not, I think, what you are after. You probably want to do some extra work to save as a csv file. However, before you do that you could look at using the spreadsheet's SaveAs feature to export as a CSV directly, but it depends on how many spreadsheets you need to convert! HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
On 22/08/12 22:51, Cecilia Chavana-Bryant wrote: Steven, (now from my new account without all the long-winded signature) can files be attached to posts in this forum? Yes they can, but we prefer if you just include them in the body if they are fairly short (<100 lines?) or put them on a pastebin with a link. Some mail tools/servers/smartphones don't like mail attachments. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
I highly recommend the Google Python class that is found on YouTube. The first video is found at http://www.youtube.com/watch?v=tKTZoB2Vjuk The supporting class materials and assignments are found at http://code.google.com/edu/languages/google-python-class/ . This series of videos begins at a pretty basic level, but subsequent videos increase the difficulty level pretty rapidly. Don't despair - the concept of how to properly manipulate strings, lists, tuples, and other objects is rather daunting, but if you're working on your doctoral studies, you already know that complex concepts aren't simply soaked up like water to a sponge ;). Ray On 08/22/2012 03:10 AM, Cecilia Chavana-Bryant wrote: > Dear all, > > I am just returning to my doctoral studies after a 7-month medical > leave and desperately trying to catch up for lost time. I am > COMPLETELY new to programming, well, I did try learning C for 3 weeks > 3 yrs ago (with very little success) but had to stop and then spent 2 > years in the Amazon climbing trees (lots more enjoyable than learning > to programme!) and collecting loads of field data that I now need to > post-process and analyse. By the way, the 3 weeks I spent trying to > learn C really ended up being spent trying to get to grips with using > a terminal for the first time in my life. > > Since getting back to work, I was advised to try learning Python > instead of C as it is a much easier first language to learn. I have > been trying, but again, to not great success. I started following "A > Primer on Scientific programming with Python" but I kept getting lost > and stuck, specially on the exercises. I have also been advised that I > should not try to learn programming by following guides but by trying > to write the programmes I need to analyse my data. Although I can > understand the logic behind this last bit of advise (it gives context > and direction to the learning process) I have also gotten stuck trying > this approach as "I do not know how to programme!". Thus, I was hoping > that some of you can remember how you got started and point me towards > any really good interactive learning guides/materials and/or have a > good learning strategy for a complete beginner. I have searched the > web and was overwhelmed by choice of tutorials and guides. I have > skimmed through a couple of tutorials but then fail to see how all > that relates to my own work and I get stuck with what seems like basic > important concepts so I don't progress. I then think I should try to > make some progress with my own data analysing and go back to trying to > learn to write a programme for my specific needs and get stuck again > because this requires more advanced skills then the basic programming > concepts I have been reading about on the learning guides. So, I am > now feeling VERY frustrated and have no idea what on Earth I am doing! > Can anyone please offer guidance in my learning process? I don't know > how and what I should be spending my time learning first and/or if I > should focus my learning towards the skill areas I will require to > write my specific programmes, although I have no idea what these are. > I would like advise on finding some really good interactive(let you > know if your solution to an exercise is correct or not) and or video > tutorials that give you feedback on the solutions you write to > exercises. > > Many thanks in advance for all your help, it will be much appreciated! > > > > Cecilia Chavana-Bryant > DPhil Candidate - Remote sensing and tropical phenology > Environmental Change Institute > School of Geography and the Environment > University of Oxford > South Parks Road, Oxford, OX1 3QY > Web: http://www.eci.ox.ac.uk/teaching/doctoral/chavanabryantcecilia.php > Tel Direct: +44 (0)1865 275861 > Fax: +44 (0)1865 275885 > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
Hi Cecilia, You've had a lot of good replies already, but I'd like to add the following points if I may: 1) You probably should figure out as much as that's possible up front exactly you're trying to do in terms of data processing first (e.g. some idea of the stats, graphs, summaries, operations etc), and then figure out whether Python is in fact the quickest/best way to get there for you. Python is very capable, it has many data analysis libraries and so on and is used by many scientists (NumPy, SciPy, Pandas comes to mind offhand), but then there are also many other languages and system also appropriate in this sphere. (R comes to mind.) Your goal (from my point of view) is not to become a programmer, but to get your research done. Python may be the way to achieve that, but from where I'm sitting it may also not be. 2) It may be useful to take some suitable courses from some of the very good free online courses now available from various sources such as Coursera. Some examples that seem relevant: Computing for Data Analysis: https://www.coursera.org/course/compdata Mathematics Biostatistics Boot camp: https://www.coursera.org/course/biostats Data Analysis https://www.coursera.org/course/dataanalysis There are also courses covering basic programming, including Python, for example: https://www.coursera.org/course/programming1 HTH, Walter ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
On 22/08/12 11:10, Cecilia Chavana-Bryant wrote: "I do not know how to programme!". Thus, I was hoping that some of you can remember how you got started and point me towards any really good interactive learning guides/materials and/or have a good learning strategy for a complete beginner. At the risk of self promotion you could try the early stages of my tutorial (see .sig). It starts from level zero and explains the concepts of programming before getting started writing code. I personally found that to be fundamental to my learning when I started (and why I included it!). It then goes through the basic programming structures using very simple examples - a multiplication table and address book mainly. (It includes VBScript and Javascript examples too but feel free to ignore them if you find they confuse more than help! The intent is to show the common structures present in all programming languages :-) Whether you progress beyond the first two sections depends on what you want to do next. Those would be enough to start writing programs related to your work and switching to another tutor at that point might be effective. But the concepts topics at the start of my tutor are I think relatively unique, and if diving straight into writing code isn't working maybe a view of the bigger picture will help. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
On Wed, Aug 22, 2012 at 11:33 AM, Cecilia Chavana-Bryant wrote: > Hola Bill, > > Many thanks for your reply to my post, you seem to understand the > predicament I am in very well. Unfortunately, I am currently working from > home and do not have someone close by to help and this is why I came to this > space. This is also why I asked for advise about interactive tutorials or > video tutorials. I have found that I keep getting lost with the more > traditional tutorials where you just read and then do exercises. Following > the guide I mentioned on my initial post I got through the first 2 chapters > but I found them quite hard going. I don't know if this makes me not a > complete beginner but I certainly do not feel like I learned much from > reading them. Maybe it is the trying to learn the "computer ecosystem" of > terminal commands at the same time that is making this learning process so > tough. > > With respect to my field data, during my 2 yrs of fieldwork I collected a > large amount of data which is currently stored in excel files. My research > involves remote sensing (data from Earth-observation satellites) and I work > with data from the MODIS NASA satellite which monitors the health of forest > canopies using reflectance data. My research is based in the Amazon. I have > collected field data to monitor the leaf dynamics of canopy leaves during > the dry season. Dry season is the time of year when many tropical trees > change their old leaves for new ones. New leaves are more photosynthetically > active (absorb more carbon from and release more oxygen into the atmosphere) > so the leaf exchange of such a large forest region as the Amazon can have > huge effects on regional and global carbon and water cycles and thus on > global climate (apologies if I'm giving you loads more information than you > need or requested?!). My data involves a large amount of data on leaf > demography (we demographically surveyed more than 120,000 leaves), and > thousands of morphological and reflectance measurements. I will have to > reorganise this data and create a few easily manipulable datasets so I can > sort data according to leaf age, canopy position, date, etc. Then I will > have to do statistical analyses on the data. I will also have to model some > of the data. > > Many thanks for taking the time to respond to my post so comprehensively and > for your good wishes. > > > Cecilia Chavana-Bryant > DPhil Candidate - Remote sensing and tropical phenology > Environmental Change Institute > School of Geography and the Environment > University of Oxford > South Parks Road, Oxford, OX1 3QY > Web: http://www.eci.ox.ac.uk/teaching/doctoral/chavanabryantcecilia.php > Tel Direct: +44 (0)1865 275861 > Fax: +44 (0)1865 275885 > ________ > From: William R. Wing (Bill Wing) [w...@mac.com] > Sent: 22 August 2012 15:17 > To: Cecilia Chavana-Bryant > Cc: William R. Wing (Bill Wing) > Subject: Re: [Tutor] Hello Python Tutor - help please! > > On Aug 22, 2012, at 6:10 AM, Cecilia Chavana-Bryant > wrote: > > Dear all, > > I am just returning to my doctoral studies after a 7-month medical leave and > desperately trying to catch up for lost time. I am COMPLETELY new to > programming, well, I did try learning C for 3 weeks 3 yrs ago (with very > little success) but had to stop and then spent 2 years in the Amazon > climbing trees (lots more enjoyable than learning to programme!) and > collecting loads of field data that I now need to post-process and analyse. > By the way, the 3 weeks I spent trying to learn C really ended up being > spent trying to get to grips with using a terminal for the first time in my > life. > > > Could you say a few words about what the field data is, and how you hope to > analyze it. That is, are you headed in the direction of plotting species > density on maps, or the time evolution of something, or doing statistics? > > Since getting back to work, I was advised to try learning Python instead of > C as it is a much easier first language to learn. I have been trying, but > again, to not great success. I started following "A Primer on Scientific > programming with Python" but I kept getting lost and stuck, specially on the > exercises. I have also been advised that I should not try to learn > programming by following guides but by trying to write the programmes I need > to analyse my data. Although I can understand the logic behind this last bit > of advise (it gives context and direction to the learning process) I have > also gotten stuck trying this approach as "I do not know how to programme!". > Thus, I was hoping that some of you can remember how you got started and > point me towar
Re: [Tutor] Hello Python Tutor - help please!
Hola Bill, Many thanks for your reply to my post, you seem to understand the predicament I am in very well. Unfortunately, I am currently working from home and do not have someone close by to help and this is why I came to this space. This is also why I asked for advise about interactive tutorials or video tutorials. I have found that I keep getting lost with the more traditional tutorials where you just read and then do exercises. Following the guide I mentioned on my initial post I got through the first 2 chapters but I found them quite hard going. I don't know if this makes me not a complete beginner but I certainly do not feel like I learned much from reading them. Maybe it is the trying to learn the "computer ecosystem" of terminal commands at the same time that is making this learning process so tough. With respect to my field data, during my 2 yrs of fieldwork I collected a large amount of data which is currently stored in excel files. My research involves remote sensing (data from Earth-observation satellites) and I work with data from the MODIS NASA satellite which monitors the health of forest canopies using reflectance data. My research is based in the Amazon. I have collected field data to monitor the leaf dynamics of canopy leaves during the dry season. Dry season is the time of year when many tropical trees change their old leaves for new ones. New leaves are more photosynthetically active (absorb more carbon from and release more oxygen into the atmosphere) so the leaf exchange of such a large forest region as the Amazon can have huge effects on regional and global carbon and water cycles and thus on global climate (apologies if I'm giving you loads more information than you need or requested?!). My data involves a large amount of data on leaf demography (we demographically surveyed more than 120,000 leaves), and thousands of morphological and reflectance measurements. I will have to reorganise this data and create a few easily manipulable datasets so I can sort data according to leaf age, canopy position, date, etc. Then I will have to do statistical analyses on the data. I will also have to model some of the data. Many thanks for taking the time to respond to my post so comprehensively and for your good wishes. Cecilia Chavana-Bryant DPhil Candidate - Remote sensing and tropical phenology Environmental Change Institute School of Geography and the Environment University of Oxford South Parks Road, Oxford, OX1 3QY Web: http://www.eci.ox.ac.uk/teaching/doctoral/chavanabryantcecilia.php Tel Direct: +44 (0)1865 275861 Fax: +44 (0)1865 275885 From: William R. Wing (Bill Wing) [w...@mac.com] Sent: 22 August 2012 15:17 To: Cecilia Chavana-Bryant Cc: William R. Wing (Bill Wing) Subject: Re: [Tutor] Hello Python Tutor - help please! On Aug 22, 2012, at 6:10 AM, Cecilia Chavana-Bryant mailto:cecilia.chavana-bry...@ouce.ox.ac.uk>> wrote: Dear all, I am just returning to my doctoral studies after a 7-month medical leave and desperately trying to catch up for lost time. I am COMPLETELY new to programming, well, I did try learning C for 3 weeks 3 yrs ago (with very little success) but had to stop and then spent 2 years in the Amazon climbing trees (lots more enjoyable than learning to programme!) and collecting loads of field data that I now need to post-process and analyse. By the way, the 3 weeks I spent trying to learn C really ended up being spent trying to get to grips with using a terminal for the first time in my life. Could you say a few words about what the field data is, and how you hope to analyze it. That is, are you headed in the direction of plotting species density on maps, or the time evolution of something, or doing statistics? Since getting back to work, I was advised to try learning Python instead of C as it is a much easier first language to learn. I have been trying, but again, to not great success. I started following "A Primer on Scientific programming with Python" but I kept getting lost and stuck, specially on the exercises. I have also been advised that I should not try to learn programming by following guides but by trying to write the programmes I need to analyse my data. Although I can understand the logic behind this last bit of advise (it gives context and direction to the learning process) I have also gotten stuck trying this approach as "I do not know how to programme!". Thus, I was hoping that some of you can remember how you got started and point me towards any really good interactive learning guides/materials and/or have a good learning strategy for a complete beginner. I have searched the web and was overwhelmed by choice of tutorials and guides. I have skimmed through a couple of tutorials but then fail to see how all that relates to my own work and I get stuck with what seems like basic important concepts so I don'
Re: [Tutor] Hello Python Tutor - help please!
Hello Cecilia, My replies are below, interleaved with your comments, which are prefixed with > marks. On 22/08/12 20:10, Cecilia Chavana-Bryant wrote: By the way, the 3 weeks I spent trying to learn C really ended up being spent trying to get to grips with using a terminal for the first time in my life. Unfortunately, there will be a certain amount of that, or at least something quite similar to a terminal. Fortunately, using Python in the terminal is usually MUCH easier than C, and in my experience using Python's interactive interpreter is one of the best ways to learn the language. What sort of computer are you using? Windows, Linux, Macintosh, or something different? I think that most of the people here use Linux or Windows, but we can probably help you one way or the other. Since getting back to work, I was advised to try learning Python instead of C as it is a much easier first language to learn. Yes, definitely, but it is still programming. Don't overestimate the difficulty, if it was hard programmers couldn't learn to do it *wink*, but on the other hand it's not trivial either. I have been trying, but again, to not great success. I started following "A Primer on Scientific programming with Python" but I kept getting lost and stuck, specially on the exercises. If you are willing to make a good, honest effort on the exercises first, we're happy to help you with them. We do like to see your attempt first, so that we can suggest fixes rather than solve the problem for you. I have also been advised that I should not try to learn programming by following guides but by trying to write the programmes I need to analyse my data. Although I can understand the logic behind this last bit of advise (it gives context and direction to the learning process) I have also gotten stuck trying this approach as "I do not know how to programme!". I'm entirely with you there. Having direction in your learning is a good thing. But until you understand the basic skills you need, it will be nothing but frustration and pain! I recommend that, if nothing else, you work through some basic tutorials so that you at least have some idea of basic language constructs like: - strings - lists - functions - ints - floats - basic arithmetic - importing modules etc. You could start with the official Python tutorial: http://docs.python.org/tutorial/index.html although I find that it is sometimes a bit wordy. (I should talk...) If you get stuck, don't hesitate to come back and ask questions, that's why we're here. Thus, I was hoping that some of you can remember how you got started I learned from the book "Learning Python" by Mark Lutz and David Ascher, and then by writing oodles and oodles of really bad code which I have long since thrown away :) [...] So, I am now feeling VERY frustrated and have no idea what on Earth I am doing! Can anyone please offer guidance in my learning process? I feel your pain! That's how I feel every time I try to understand monads in Haskell (don't ask!). How about if you start off with a simple question you would like to solve using Python? Something relevant to your work. You may need to explain some of the concepts to us, since we're not ecologists. (At least, I'm not, I can't speak for others.) We can then try to guide you to a solution and introduce concepts as we go. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
If you don't have any prior programmers skills, i would advice first to learn the basics. You will need a good foundation, before it is possible to create complex functions. Starting with complex functions is only frustrating if you don't understand the basics. From: cecilia.chavana-bry...@ouce.ox.ac.uk To: tutor@python.org Date: Wed, 22 Aug 2012 10:10:46 + Subject: [Tutor] Hello Python Tutor - help please! Dear all, I am just returning to my doctoral studies after a 7-month medical leave and desperately trying to catch up for lost time. I am COMPLETELY new to programming, well, I did try learning C for 3 weeks 3 yrs ago (with very little success) but had to stop and then spent 2 years in the Amazon climbing trees (lots more enjoyable than learning to programme!) and collecting loads of field data that I now need to post-process and analyse. By the way, the 3 weeks I spent trying to learn C really ended up being spent trying to get to grips with using a terminal for the first time in my life. Since getting back to work, I was advised to try learning Python instead of C as it is a much easier first language to learn. I have been trying, but again, to not great success. I started following "A Primer on Scientific programming with Python" but I kept getting lost and stuck, specially on the exercises. I have also been advised that I should not try to learn programming by following guides but by trying to write the programmes I need to analyse my data. Although I can understand the logic behind this last bit of advise (it gives context and direction to the learning process) I have also gotten stuck trying this approach as "I do not know how to programme!". Thus, I was hoping that some of you can remember how you got started and point me towards any really good interactive learning guides/materials and/or have a good learning strategy for a complete beginner. I have searched the web and was overwhelmed by choice of tutorials and guides. I have skimmed through a couple of tutorials but then fail to see how all that relates to my own work and I get stuck with what seems like basic important concepts so I don't progress. I then think I should try to make some progress with my own data analysing and go back to trying to learn to write a programme for my specific needs and get stuck again because this requires more advanced skills then the basic programming concepts I have been reading about on the learning guides. So, I am now feeling VERY frustrated and have no idea what on Earth I am doing! Can anyone please offer guidance in my learning process? I don't know how and what I should be spending my time learning first and/or if I should focus my learning towards the skill areas I will require to write my specific programmes, although I have no idea what these are. I would like advise on finding some really good interactive(let you know if your solution to an exercise is correct or not) and or video tutorials that give you feedback on the solutions you write to exercises. Many thanks in advance for all your help, it will be much appreciated! Cecilia Chavana-Bryant DPhil Candidate - Remote sensing and tropical phenology Environmental Change Institute School of Geography and the Environment University of Oxford South Parks Road, Oxford, OX1 3QY Web: http://www.eci.ox.ac.uk/teaching/doctoral/chavanabryantcecilia.php Tel Direct: +44 (0)1865 275861 Fax: +44 (0)1865 275885 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hello Python Tutor - help please!
Hello, My highest recommendation for you is to start with a simple hello world program. Study that program, each line. Think about how and most importantly, why it works. Then, extend on it. Make it write to a file instead of a terminal. Then make it read from a file and print to the terminal. Then make it print one letter to each file, then read them back in and reconstruct the sentence. Just take it slow, and one step at a time. So many times people simply go for complex solutions and get lost in the complexity. Sorry for top posting. My phone client doesn't support inline replies. -Mario -- From: Cecilia Chavana-Bryant Sent: 8/22/2012 6:35 AM To: tutor@python.org Subject: [Tutor] Hello Python Tutor - help please! Dear all, I am just returning to my doctoral studies after a 7-month medical leave and desperately trying to catch up for lost time. I am COMPLETELY new to programming, well, I did try learning C for 3 weeks 3 yrs ago (with very little success) but had to stop and then spent 2 years in the Amazon climbing trees (lots more enjoyable than learning to programme!) and collecting loads of field data that I now need to post-process and analyse. By the way, the 3 weeks I spent trying to learn C really ended up being spent trying to get to grips with using a terminal for the first time in my life. Since getting back to work, I was advised to try learning Python instead of C as it is a much easier first language to learn. I have been trying, but again, to not great success. I started following "A Primer on Scientific programming with Python" but I kept getting lost and stuck, specially on the exercises. I have also been advised that I should not try to learn programming by following guides but by trying to write the programmes I need to analyse my data. Although I can understand the logic behind this last bit of advise (it gives context and direction to the learning process) I have also gotten stuck trying this approach as "I do not know how to programme!". Thus, I was hoping that some of you can remember how you got started and point me towards any really good interactive learning guides/materials and/or have a good learning strategy for a complete beginner. I have searched the web and was overwhelmed by choice of tutorials and guides. I have skimmed through a couple of tutorials but then fail to see how all that relates to my own work and I get stuck with what seems like basic important concepts so I don't progress. I then think I should try to make some progress with my own data analysing and go back to trying to learn to write a programme for my specific needs and get stuck again because this requires more advanced skills then the basic programming concepts I have been reading about on the learning guides. So, I am now feeling VERY frustrated and have no idea what on Earth I am doing! Can anyone please offer guidance in my learning process? I don't know how and what I should be spending my time learning first and/or if I should focus my learning towards the skill areas I will require to write my specific programmes, although I have no idea what these are. I would like advise on finding some really good interactive(let you know if your solution to an exercise is correct or not) and or video tutorials that give you feedback on the solutions you write to exercises. Many thanks in advance for all your help, it will be much appreciated! Cecilia Chavana-Bryant DPhil Candidate - Remote sensing and tropical phenology Environmental Change Institute School of Geography and the Environment University of Oxford South Parks Road, Oxford, OX1 3QY Web: http://www.eci.ox.ac.uk/teaching/doctoral/chavanabryantcecilia.php Tel Direct: +44 (0)1865 275861 Fax: +44 (0)1865 275885 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor