Fill Random Marks
import numpy as np
import pandas as pd
datatype = [('Science', 'int32'), ('Maths', 'int32')]
current_values = np.zeros(3, dtype=datatype)
current_index = ['Row '+str(i) for i in range(1, 4)]
df = pd.DataFrame(current_values, index=current_index)
df
Science | Maths | |
---|---|---|
Row 1 | 0 | 0 |
Row 2 | 0 | 0 |
Row 3 | 0 | 0 |
df['Science']
Row 1 0
Row 2 0
Row 3 0
Name: Science, dtype: int32
df['Science'][0] = 45
df['Maths'][1] = 100
df
Science | Maths | |
---|---|---|
Row 1 | 45 | 0 |
Row 2 | 0 | 100 |
Row 3 | 0 | 0 |
df.shape
(3, 2)