python-ecology-lesson
python-ecology-lesson copied to clipboard
Using display() command instead of print() in 02-starting-with-data and added assignment of data types
(a) I would suggest to introduce the use of the display() function from the IPython package, which is preferred over print() for pandas. display() give essentially the same output as typing a pandas data frame name into the Python command prompt or at the end of a code block, but it is useful for longer code blocks. (b) I would suggest to explain that surveys_df.dtypes can be easily adjusted by one line of code, for instance for the 'sex' column, a categorical datatype might be preferred instead of 'object', or 'int16' instead of 'int64' for the columns 'month' or 'year'. I hope this can be useful, let me know what you think.