I want to check if the Multi and Single are of type float or string. How would I be able to check the type of multi dimensional arrays and single dimensional arrays.
csv file:
Multi,Single
[[20]|[yes]],[35|50]
Code:
import pandas pd
check = pd.read_csv("file.csv")
if (not isinstance(check["Multi"], (float, int))):
print(f'Invalid value: {check["Multi"]} must be int or float')
if (not isinstance(check["Single"], (float, int))):
print(f'Invalid value: {check["Single"]} must be int or float')
Error:
Invalid value: [[20]|[yes]] must be int or float
Aucun commentaire:
Enregistrer un commentaire