pd.to_parquet not owrking, but also is?

So I am trying to update the parquet file as well as google sheet at the same time, it works, but also doesn’t it does seem to update the file at first glace from the reading in the file, but only if I filter it a specific way, the way i filter it in order to edit the information, but if i were to niot filter it like that it doesn’t seem to update same goes if I dont filter it at all as well. the google sheet part of it works fine, but the parquet filr it self is not. for context as well, I have 2 pages at play in this case, add qr page dediicated to assign customer’s name and the status to the selected qr, and the main update oage in order to post a customer’s follow up on another lets call it update page

this is my current code for the update function:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def update_qr(sname, customer, status, qr):
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
sheet = client.open('qr_report').sheet1
# Load existing CSV data into a DataFrame
csv_file_path = f'{sname}_qr_report.parquet'
df = qr_report
filter_condition1 = df['QR Number'] == qr
print(df[filter_condition1])
df.loc[filter_condition1, ['cus_name', 'status', 'followup plan', 'update date', 'usernmae'][customer, status, get_followup_plan(status), now, sname]
df.to_parquet(csv_file_path, index=False)
print(df[filter_condition1])
try:
df.to_parquet(csv_file_path, engine='pyarrow', index=False)
print(f"DataFrame written to {csv_file_path} successfully.")
except Exception as e:
print(f"Error: {e}")
df_read = pd.read_parquet(csv_file_path, engine='pyarrow')
print(df_read[filter_condition1])
cell = sheet.find(qr)
if cell:
row = cell.row
sheet.update_cell(row, 3, customer)
sheet.update_cell(row, 4, status)
sheet.update_cell(row, 5, get_followup_plan(status))
sheet.update_cell(row, 10, sname)
else:
raise ValueError(f'Cannot find a cell with {qr} as the QR Number')
get_file_df(sname)
</code>
<code>def update_qr(sname, customer, status, qr): now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') sheet = client.open('qr_report').sheet1 # Load existing CSV data into a DataFrame csv_file_path = f'{sname}_qr_report.parquet' df = qr_report filter_condition1 = df['QR Number'] == qr print(df[filter_condition1]) df.loc[filter_condition1, ['cus_name', 'status', 'followup plan', 'update date', 'usernmae'][customer, status, get_followup_plan(status), now, sname] df.to_parquet(csv_file_path, index=False) print(df[filter_condition1]) try: df.to_parquet(csv_file_path, engine='pyarrow', index=False) print(f"DataFrame written to {csv_file_path} successfully.") except Exception as e: print(f"Error: {e}") df_read = pd.read_parquet(csv_file_path, engine='pyarrow') print(df_read[filter_condition1]) cell = sheet.find(qr) if cell: row = cell.row sheet.update_cell(row, 3, customer) sheet.update_cell(row, 4, status) sheet.update_cell(row, 5, get_followup_plan(status)) sheet.update_cell(row, 10, sname) else: raise ValueError(f'Cannot find a cell with {qr} as the QR Number') get_file_df(sname) </code>
def update_qr(sname, customer, status, qr):
    now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    sheet = client.open('qr_report').sheet1

    # Load existing CSV data into a DataFrame
    csv_file_path = f'{sname}_qr_report.parquet'
    df = qr_report
    filter_condition1 = df['QR Number'] == qr
    print(df[filter_condition1])
    df.loc[filter_condition1, ['cus_name', 'status', 'followup plan', 'update date', 'usernmae'][customer, status, get_followup_plan(status), now, sname]
    df.to_parquet(csv_file_path, index=False)
    print(df[filter_condition1])
    try:
        df.to_parquet(csv_file_path, engine='pyarrow', index=False)
        print(f"DataFrame written to {csv_file_path} successfully.")
    except Exception as e:
        print(f"Error: {e}")
    df_read = pd.read_parquet(csv_file_path, engine='pyarrow')
    print(df_read[filter_condition1])

    cell = sheet.find(qr)
    if cell:
        row = cell.row
        sheet.update_cell(row, 3, customer)
        sheet.update_cell(row, 4, status)
        sheet.update_cell(row, 5, get_followup_plan(status))
        sheet.update_cell(row, 10, sname)
    else:
        raise ValueError(f'Cannot find a cell with {qr} as the QR Number')
    get_file_df(sname)

here is the filter on the add qr page:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def get_qrlist_to_add(sname):
start = time.time()
df = qr_report
salecode = get_salecode(sname)
print(salecode)
df['sale code'] = df['sale code'].astype(str)
data = df[df['cus_name']==''][df['sale code'].isin(salecode)][['QR Number', 'description']].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False).values.tolist()
result = [' '.join(map(str, x)) for x in data]
end = time.time()
print(f'it takes {end-start} seconds to add qrs.')
return result
</code>
<code>def get_qrlist_to_add(sname): start = time.time() df = qr_report salecode = get_salecode(sname) print(salecode) df['sale code'] = df['sale code'].astype(str) data = df[df['cus_name']==''][df['sale code'].isin(salecode)][['QR Number', 'description']].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False).values.tolist() result = [' '.join(map(str, x)) for x in data] end = time.time() print(f'it takes {end-start} seconds to add qrs.') return result </code>
def get_qrlist_to_add(sname):
    start = time.time()
    df = qr_report
    salecode = get_salecode(sname)
    print(salecode)
    df['sale code'] = df['sale code'].astype(str)
    data = df[df['cus_name']==''][df['sale code'].isin(salecode)][['QR Number', 'description']].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False).values.tolist()
    result = [' '.join(map(str, x)) for x in data]
    end = time.time()
    print(f'it takes {end-start} seconds to add qrs.')
    return result

here is the filter for the update page:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def filter_qrlist(sname, cname):
# Open the workbook using gspread_pandas
df = qr_report # Assuming the data is in 'Sheet1'
sf = pd.read_parquet('status qr.parquet', engine='pyarrow')
df['status'] = df['status'].astype(str)
df = pd.merge(df, sf, on='status', how='left')
# Filter the DataFrame based on the customer name and sort it in descending alphabetical order
filtered_df = df[df['cus_name'] == cname][df['username'] == sname].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False)
bad_status = ['Win', 'Lose', 'ปรับสเปค-ปรับราคา', 'ไม่พบ QR']
qrs = filtered_df[~filtered_df['Follow up Plan'].isin(bad_status)][['QR Number', 'description']].values.tolist()
qr_list = [' '.join(map(str, qr)) for qr in qrs]
return qr_list
</code>
<code>def filter_qrlist(sname, cname): # Open the workbook using gspread_pandas df = qr_report # Assuming the data is in 'Sheet1' sf = pd.read_parquet('status qr.parquet', engine='pyarrow') df['status'] = df['status'].astype(str) df = pd.merge(df, sf, on='status', how='left') # Filter the DataFrame based on the customer name and sort it in descending alphabetical order filtered_df = df[df['cus_name'] == cname][df['username'] == sname].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False) bad_status = ['Win', 'Lose', 'ปรับสเปค-ปรับราคา', 'ไม่พบ QR'] qrs = filtered_df[~filtered_df['Follow up Plan'].isin(bad_status)][['QR Number', 'description']].values.tolist() qr_list = [' '.join(map(str, qr)) for qr in qrs] return qr_list </code>
def filter_qrlist(sname, cname):
    # Open the workbook using gspread_pandas
    df = qr_report # Assuming the data is in 'Sheet1'
    sf = pd.read_parquet('status qr.parquet', engine='pyarrow')
    df['status'] = df['status'].astype(str)
    df = pd.merge(df, sf, on='status', how='left')
    # Filter the DataFrame based on the customer name and sort it in descending alphabetical order
    filtered_df = df[df['cus_name'] == cname][df['username'] == sname].drop_duplicates(keep='last', subset=['QR Number']).sort_values(by='QR Number', ascending=False)
    bad_status = ['Win', 'Lose', 'ปรับสเปค-ปรับราคา', 'ไม่พบ QR']
    qrs = filtered_df[~filtered_df['Follow up Plan'].isin(bad_status)][['QR Number', 'description']].values.tolist()
    qr_list = [' '.join(map(str, qr)) for qr in qrs]

    return qr_list

what would happen is i would select a qr on the add qr page, and it would be just fine, the qr would be removed from the list as it is updated through the parquet file, but the problem comes when I take a look at the update page, as no matter how much i tired to update the list the new ones would not show up. i also checked the parquet file and it is some how not updated either.

I expected the code to update the parquet file properly. and also update the qrlist as well here is the update qrlist function for both of the file:
addqr:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def update_qrlist(self):
for widget in self.qrlist_inner_frame.winfo_children():
widget.destroy()
qrlist_items = connection.get_qrlist_to_add(self.sname)
self.qrlist_vars = {}
self.qrlist_checks = {}
for item in qrlist_items:
var = tk.BooleanVar()
chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, bg="white", font=('Arial', 14))
chk.pack(anchor="w")
self.qrlist_vars[item] = var
self.qrlist_checks[item] = chk
update page:
def update_qrlist(self):
for widget in self.qrlist_inner_frame.winfo_children():
widget.destroy()
selected_company = self.company_var.get()
if not self.qrlist_filtered:
qrlist_items = ['None'] + connection.get_qrlist(sname=self.sname, cname=selected_company)
self.change_qrlist_button.config(text='Filter QR')
else:
qrlist_items = ['None'] + connection.filter_qrlist(sname=self.sname, cname=selected_company)
self.change_qrlist_button.config(text='Show All QR')
self.qrlist_vars = {}
self.qrlist_checks = {}
for item in qrlist_items:
var = tk.BooleanVar()
chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, command=self.qrlist_select, bg="white", font=("Arial", 14))
chk.pack(anchor="w")
self.qrlist_vars[item] = var
self.qrlist_checks[item] = chk
</code>
<code>def update_qrlist(self): for widget in self.qrlist_inner_frame.winfo_children(): widget.destroy() qrlist_items = connection.get_qrlist_to_add(self.sname) self.qrlist_vars = {} self.qrlist_checks = {} for item in qrlist_items: var = tk.BooleanVar() chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, bg="white", font=('Arial', 14)) chk.pack(anchor="w") self.qrlist_vars[item] = var self.qrlist_checks[item] = chk update page: def update_qrlist(self): for widget in self.qrlist_inner_frame.winfo_children(): widget.destroy() selected_company = self.company_var.get() if not self.qrlist_filtered: qrlist_items = ['None'] + connection.get_qrlist(sname=self.sname, cname=selected_company) self.change_qrlist_button.config(text='Filter QR') else: qrlist_items = ['None'] + connection.filter_qrlist(sname=self.sname, cname=selected_company) self.change_qrlist_button.config(text='Show All QR') self.qrlist_vars = {} self.qrlist_checks = {} for item in qrlist_items: var = tk.BooleanVar() chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, command=self.qrlist_select, bg="white", font=("Arial", 14)) chk.pack(anchor="w") self.qrlist_vars[item] = var self.qrlist_checks[item] = chk </code>
def update_qrlist(self):
        for widget in self.qrlist_inner_frame.winfo_children():
            widget.destroy()
        qrlist_items = connection.get_qrlist_to_add(self.sname)

        self.qrlist_vars = {}
        self.qrlist_checks = {}

        for item in qrlist_items:
            var = tk.BooleanVar()
            chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, bg="white", font=('Arial', 14))
            chk.pack(anchor="w")
            self.qrlist_vars[item] = var
            self.qrlist_checks[item] = chk

update page:
    def update_qrlist(self):
        for widget in self.qrlist_inner_frame.winfo_children():
            widget.destroy()

        selected_company = self.company_var.get()
        if not self.qrlist_filtered:
            qrlist_items = ['None'] + connection.get_qrlist(sname=self.sname, cname=selected_company)
            self.change_qrlist_button.config(text='Filter QR')
        else:
            qrlist_items = ['None'] + connection.filter_qrlist(sname=self.sname, cname=selected_company)
            self.change_qrlist_button.config(text='Show All QR')

        self.qrlist_vars = {}
        self.qrlist_checks = {}

        for item in qrlist_items:
            var = tk.BooleanVar()
            chk = tk.Checkbutton(self.qrlist_inner_frame, text=item, variable=var, command=self.qrlist_select, bg="white", font=("Arial", 14))
            chk.pack(anchor="w")
            self.qrlist_vars[item] = var
            self.qrlist_checks[item] = chk

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật