zak100 Posted September 1, 2020 Posted September 1, 2020 Hi, I am trying to execute the following code: df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=['a', 'b', 'c']) df2 = pd.DataFrame(data=d, dtype=np.int8) print(df2) I am getting the following error message: Quote df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=['a', 'b', 'c']) NameError: name 'np' is not defined Somebody please guide me. Zulfi.
Ghideon Posted September 1, 2020 Posted September 1, 2020 24 minutes ago, zak100 said: NameError: name 'np' is not defined What happens of you import numpy? Quote import numpy as np 1
zak100 Posted September 2, 2020 Author Posted September 2, 2020 Hi, Your solution worked. Thanks a lot for your help. God blesses you. Zulfi.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now