Skip to content

Tag: python

How to update a single value in redis hash

I’m using Python FastAPI with redis. I wrote a function to update values in a redis hash, but I couldn’t able to update a single value alone, I could only able to re-write the whole hash. My model: My function: Answer hmset is deprecated for hset – but if you want to only update a single key…

Python web-scraper not working for TripAdvisor

I am trying to write a simple Python scraper in order to save all the reviews of a specific place on TripAdvisor. The specific link I am using as example is the following: https://www.tripadvisor.com/Attraction_Review-g319796-d5988326-Reviews-or50-Museo_de_Altamira-Santillana_del_Mar_Cantabria.html Here is th…

Nested JSON to Multiple Dataframe in Pandas

I am trying to build a tool which can take any JSON data and convert that into multiple data frame based on data types. I am trying to add each data frame with a relation so that we can identify which data belong to which parent element(key). For Example : I wanted to have data frame such as And have

How to add multiple textfield in kivymd

i am making a form screen in which a user can input data and upload it to database. I want them to be able to add multiple textfields on a button press if they still want to add something. it should be scrollable since the amount of textfields is based on how many the user really wants. i have this

How to scroll down to last row with data?

I have an Excel file with many rows and it gets many entries daily. That’s why I would like to scroll down the file to last row with data. To find the last row, I use: How could I scroll down to it using Python (and preferably XLWings module)? Answer Use used_range, it’s more robust than expand(&#…

How to group by month and year from a specific range?

The data have reported values for January 2006 through January 2019. I need to compute the total number of passengers Passenger_Count per month. The dataframe should have 121 entries (10 years * 12 months, plus 1 for january 2019). The range should go from 2009 to 2019. I have been doing: But it doesn’t…

How do I name the dataframe index after a variable result?

I have a variable called ‘Specimen’ from a dataframe imported from a xlsx file, and I want to implement the result of this variable (in this case 25) in a new dataframe? What I have: array([[25.0]], dtype=object) What I want: I have tried But this gives the following error: TypeError: RangeIndex.n…