I am running the following code
import pandas as pd
import numpy as np
import tensorflow as tf
california_housing_dataframe = pd.read_csv("https://download.mlcc.google.com/mledu-datasets/california_housing_train.csv", sep=",")
california_housing_dataframe = california_housing_dataframe.reindex(np.random.permutation(california_housing_dataframe))
california_housing_dataframe["median_house_value"] /= 1000.0
print(california_housing_dataframe.describe())
print(california_housing_dataframe)
This causes a ValueError:
"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"
However, the same code runs in jupyter notebook (just remove the print and call the dataframe directly).
I can see that the problem is due to the "np.random.permutation" line. If I print the dataframe without doing it, it prints fine. But why is there no issue in running this in jupyter notebook? And, how do I resolve this so that I can run the .py program from the command line?