Forum Discussion
WilliamHill99
5 months agoRegular Visitor
Python in Power Query VS Code
Hi All, I would like to fetch/ read csv file from local machine and performs pivot function in Python in PowerQuery. I tested my code in VScode and result is fine and expected as it is, but it ...
- 5 months ago
py script
import pandas as pd import numpy as np df['DATE_ID'] = pd.to_datetime(df['DATE_ID']) df['Town-Citycode'] = df['Town-Citycode'].str[:9] df = df.sort_values(['Town-Citycode', 'DATE_ID']) df['diff'] = np.where(df.groupby('Town-Citycode')['SALECOUNT'].diff()>0, 'Up', 'Down') pvt = df.pivot_table(columns=['DATE_ID'], index=['Town-Citycode'], values=['SALECOUNT', 'diff'], aggfunc='sum') pvt.reset_index(inplace=True)When it comes to data visualization, DAX is often a more elegant alternative,
v-sgandrathi
Community Support
4 months agoHi WilliamHill99,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!