Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

General Discussions

Discuss any topics that are not product-specific here.

Transpose then Join

cfrederes1
5 - Atom

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:

input.jpg

 

DESIRED OUTPUT:

 

Desired Output.jpg

2 REPLIES 2
kristy236lewis
5 - Atom

@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:

input.jpg

 

DESIRED OUTPUT:

 

Desired Output.jpg


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)

Qiu
21 - Polaris
21 - Polaris

@cfrederes1 
It can be completed with the combination of Transpose and Cross Tab and not that The duplicated fields names are not allowed.

1014-cfrederes1.png

Labels