Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

NameError: name ‘pd’ is not defined

# import pandas library
import pandas as pd
import numpy as np

# create pandas DataFrame
df =  pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
                   columns=['a', 'b', 'c'])

# print dataframe
print(df)
Comment

NameError: name ‘pd’ is not defined

# import pandas library
from pandas import *
import numpy as np

# create pandas DataFrame
df =  DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
                   columns=['a', 'b', 'c'])

# print dataframe
print(df)
Comment

NameError: name ‘pd’ is not defined

# import pandas library
import pandas
import numpy as np

# create pandas DataFrame
df =  pandas.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
                   columns=['a', 'b', 'c'])

# print dataframe
print(df)
Comment

PREVIOUS NEXT
Code Example
Python :: create spark dataframe in python 
Python :: flask api response code 
Python :: make csv lowercase python 
Python :: apply strip() a column in pandas 
Python :: can you edit string.punctuation 
Python :: count number of occurrences of all elements in list python 
Python :: keras read image 
Python :: tkinter hover button 
Python :: np replace nan 
Python :: python invert dictionary 
Python :: decode base64 with python 
Python :: remove duplicates based on two columns in dataframe 
Python :: python loop certain number of times 
Python :: how to change the column order in pandas dataframe 
Python :: two input number sum in python 
Python :: loop through 2 dataframes at once 
Python :: How to Create a Pie Chart in Seaborn 
Python :: python pandas replace nan with null 
Python :: convert every element in list to string python 
Python :: plotly hide trace from hover 
Python :: python read live radio 
Python :: main arguments python 
Python :: get values using iloc 
Python :: how to sort a column with mixed text number 
Python :: escape string for html python 
Python :: python remove a key from a dictionary 
Python :: roll longitude about zero 
Python :: python image to video 
Python :: plt show 2 images 
Python :: from matrix to array python 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =