Tutorial by Examples

Create a simple DataFrame. import numpy as np import pandas as pd # Set the seed so that the numbers can be reproduced. np.random.seed(0) df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) # Another way to set column names is "columns=['column_1_name','column_2_name','c...
import pandas as pd data = [ {'name': 'Daniel', 'country': 'Uganda'}, {'name': 'Yao', 'country': 'China'}, {'name': 'James', 'country': 'Colombia'}, ] df = pd.DataFrame(data) filename = 'people.csv' df.to_csv(filename, index=False, encoding='utf-8')

Page 1 of 1