# import necessary libraries
import pandas as pd
import numpy as np
# create a 2D NumPy array
arr = np.array([[1, 2], [3, 4]])
# convert the NumPy array to a Pandas dataframe
df = pd.DataFrame(arr, columns=['A', 'B'],
index=['row1', 'row2'])
# print the dataframe
print(df)