Sort dataframe by dates

I am importing an excel file in which a column is a date in the format dd/mm/yyyy. When I import it from the excel file, I think it is understood as a string. I need to sort the whole DataFrame by date, so I perform this code: import pandas as pd import pandas as pd… Read More Sort dataframe by dates

Export Postgresql Table to excel with header in Python

My code works but it doesn’t bring the header with the names, it only brings the numbers 0 1 … 10 , what can I do ? Utils_db.py def consulta_sql(sql): try: connection = psycopg2.connect(user="postgres", password="postgres", host="localhost", port="5432", database="tb_cliente") cursor = connection.cursor() except (Exception, psycopg2.Error) as error: try: cursor.execute(sql) connection.commit() except (Exception, psycopg2.Error) as error: finally:… Read More Export Postgresql Table to excel with header in Python

Taking the column names from the first row that has less than x Nan's

I have data as follows: import pandas as pd url_cities="https://population.un.org/wup/Download/Files/WUP2018-F12-Cities_Over_300K.xls" df_cities = pd.read_excel(url_cities) print(df_cities.iloc[0:20,]) The column names can be found in row 15, but I would like this row number to be automatically determined. I thought the best way would be to take the first row for which the values are non-Nan for less than… Read More Taking the column names from the first row that has less than x Nan's

How to make a multipart request from node js to spirng boot

I have a node js backend that needs to send a file to a spring boot application. The file is local uploads/testsheet.xlsx. Here is the code to upload the file using form-data npm module and axios. const formData = new FormData() formData.append("file", fs.createReadStream("uploads/testsheet.xlsx")); formData.append("status", status); const path = `/endpoint` const auth = { username: username,… Read More How to make a multipart request from node js to spirng boot

How to append cell values in openpyxl directly

I’m trying to append cell value using openpyxl, by appending the value directly. this works: wb1=load_workbook(‘test.xlsx’) ws1=wb1.active testlist=(‘two’,’three’,’four’,’five’) for i in testlist: ws1[‘A1’].value = ws1[‘A1’].value +(‘ ‘) + i print(ws1[‘A1’].value) A1 has a value of "one", after the loop runs it has "one two three four five" But is it possible to use the append… Read More How to append cell values in openpyxl directly