Advertisements
Advertisements
प्रश्न
Can you write the command to load the data.txt including the header row as well?
कोड लेखन
Advertisements
उत्तर
To load the data from data.txt including the header row, we can use the loadtxt() function of NumPy with the skiprows option set to 0.
import numpy as np
data = np.loadtxt('data.txt', dtype=str, delimiter=',', skiprows=0)
print(data)
Here, skiprows=0 means that no row is skipped, so the header row is also included while loading the data.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
