Hi,
I'm attempting to make a 'flat' row by the field "TN" below- I can us the crosstab function and receive the output of the highlighted fields but I can't join to bring the correlated MRC and Qty field for every USOC.
INPUT:
DESIRED OUTPUT:
@cfrederes1 wrote:Hi,
I'm attempting to make a 'flat' row by the field "TN" below- I can us the crosstab function and receive the output of the highlighted fields but I can't join to bring the correlated MRC and Qty field for every USOC.
INPUT:
DESIRED OUTPUT:
import pandas as pd
# Create a DataFrame
data = {'A': [1, 2], 'B': [3, 4]}
df = pd.DataFrame(data)
# Transpose the DataFrame
transposed_df = df.T
# Create another DataFrame to join
data2 = {'Key': ['A', 'B'], 'Value': ['X', 'Y']}
df2 = pd.DataFrame(data2)
# Join on the index of the transposed DataFrame
result = transposed_df.join(df2.set_index('Key'))
print(result)
@cfrederes1
It can be completed with the combination of Transpose and Cross Tab and not that The duplicated fields names are not allowed.