bwiley1 / pandleau

A quick and easy way to convert a Pandas DataFrame to a Tableau .hyper or .tde extract.
MIT License
60 stars 19 forks source link

Duplication of rows in tde file when read in tableau #2

Closed chaithu123 closed 6 years ago

chaithu123 commented 6 years ago

Hello bwiley1,

I was using your code and it is successful in generating the tde files, but when I tried to read the generated tde file into tableau, the tableau showing 16 rows with column incremental for 16 columns.

For clear understand the tde file with a single row and how it gets read into tableau.

Please let me know if this is issue or am I crept into some errors in the approach. capture123

Thanks Sai

chaithu123 commented 6 years ago

df=read_sql("select pnrtn,pnr,pcdt,tidt,ddt,tno,olcd,dlcd,ln,fn,ano,rf,acg,vacg from sdh_ticket where pnrtn in ('%s')" % "','".join(map(str,pnr_tn)),con=con) df['ano']=df['ano'].fillna(0., inplace=False) df['acg']=df['acg'].fillna(0., inplace=False) df['vacg']=df['vacg'].fillna(0., inplace=False) df['TOT_REV_AMT']=df['rf']+df['acg']+df['vacg'] df['AGR_STATUS']="sai" df.loc[df.ano ==0, 'AGR_STATUS'] = "AGR_NOT_USED" df.loc[df.ano !=0, 'AGR_STATUS'] = "AGR_USED" df1=df[df["pnrtn"]=="671D03_0484547095766"] df_tableau1=pandleau.pandleau(df1)

df_tableau.to_tableau('C:/Users/00819840/Documents/My Tableau Repository/Datasources/Advanced Analytics/pass_rider_final_report.tde')

df_tableau1.to_tableau('C:/Users/00819840/Downloads/pnrtn_extract2.tde')

print(df1.head())

The above is code sample of mine.

Thanks Sai

bwiley1 commented 6 years ago

Hi Sai,

Thanks so much for this feedback! There was an error in the for loop indentation - that should be fixed now. Let me know if you have any other issues using this package, thanks!