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