Skip to Main Content

Statistical Software: Python Koujue

This guide contains resources to assist faculty, researchers, staff, and students in learning statistical software, such as R, Python, SAS, Stata, SPSS

Quick Tips

Python commands are case-sensitive.

help() is used to display the documentation of modules, functions, classes, keywords etc.

#comment follows.

""" (triple quotes) starts a multi line comment and another """ (triple quotes) ends the comment.

= is assignment operator, like a = 'Hello World'.

a.upper()- an example for a Python method (result is 'HELLO WORLD').

a.lower()returns the lowercase version of a string.

print()prints an object to the screen: print("Hello World").

abs()returns the absolute value of a numeric value (e.g. integer or float).

round()returns the rounded value of a numeric value.

 A list, [2, 3, 5, 6], or ['a', 'c', 'd', 'a'].

len() returns the number of elements in a list or the number of characters in a string.

min()returns the smallest item of a list or of the typed-in arguments.

max()returns the largest item of a list or of the typed-in arguments.

sorted()sorts a list into ascending order.

sum()sums a list.

type()returns the type of an object.

a.strip()removes white space in a string

a.replace('old', 'new')replaces a given string with another string.

a.split('delimiter')splits a string into a list. a.split(' ') returns ['Hello', 'World']

'delimiter'.join(a)joins elements of a list into one string. ','.join(a) returns 'Hello, World'

dir() returns a list of valid attributes of an object.

WEB RESOURCES

THE BOOKS OF TREASURES

#1 Python Tutorial for Beginners | Introduction to Python

Python - Matplotlib Tutorial for Beginners

Top 6 Python Libraries for Beginners | Python Explained

Python Workshops/Webinars

Python Sessions

STATS HOME

Profile Photo
Jianjun Hua
Contact:
Dartmouth College

Hanover NH 03755


QUESTIONNAIRE

This guide has a user friendly interface.

QUESTIONNAIRE
Strongly agree: 12 votes (70.59%)
Agree: 4 votes (23.53%)
Neutral: 0 votes (0%)
Disagree: 0 votes (0%)
Strongly disagree: 1 votes (5.88%)
Total Votes: 17

Post-Workshop Survey