Tutorial by Examples

To get basic information about a DataFrame including the column names and datatypes: import pandas as pd df = pd.DataFrame({'integers': [1, 2, 3], 'floats': [1.5, 2.5, 3], 'text': ['a', 'b', 'c'], 'ints with None': [1, None, 3]}) ...
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]}) To list the column names in a DataFrame: >>> list(df) ['a', 'b', 'c'] This list comprehension method is especially useful when using the debugger: >>> [c for c in df] ['a', 'b', 'c'] This is the long w...
import pandas as pd df = pd.DataFrame(np.random.randn(5, 5), columns=list('ABCDE')) To generate various summary statistics. For numeric values the number of non-NA/null values (count), the mean (mean), the standard deviation std and values known as the five-number summary : min: minimum (smal...

Page 1 of 1