Pandas Dataframe function not calling correctly

I have two dataframes where I am converting float values to string as part of a vlookup process. Below are my two dataframe table layouts:


Item Number | Item Description | Item Class | Item Class Description
ABC123        Diamond            0001         Gemstone
ABC456        Sapphire           0001         Gemstone
DEF000        Silicon            0002         Mineral 


Item Class | Item Class Description
0001         Gemstone
0002         Mineral

I was able to get the Item Class values formatted correctly by doing the following (values were imported as float and had some NaNs):

df['Item Class']=df['Item Class'].fillna(value=0,inplace=False)
df['Item Class']=df['Item Class'].astype(int,copy=True,errors='raise')
df['Item Class']=df['Item Class'].astype(str,copy=True,errors='raise')
df['Item Class']=df['Item Class'].apply('{:0>4}'.format)

df2['Item Class']=df2['Item Class'].fillna(value=0,inplace=False)
df2['Item Class']=df2['Item Class'].astype(int,copy=True,errors='raise')
df2['Item Class']=df2['Item Class'].astype(str,copy=True,errors='raise')
df2['Item Class']=df2['Item Class'].apply('{:0>4}'.format)

I tried to create a function to condense this:

 def float_to_str(df_column):

But when I call the function with

float_to_str(df['Item Class']) 


float_to_str(df2['Item Class'])

instead of formatting the Item Class values, the values are not converted, and I either get the error message ‘ValueError: You are trying to merge on float64 and object columns. If you wish to proceed you should use pd.concat’, or the df2 values are left as float, indicating in both cases the function didn’t call correctly. How can I have this function call correctly to condense this code?

Problems incrementing a field of an object inside an array in firestore

In firestore, i have a collection called questions of documents with the following structure

{ category : "animals",
topics : [ {title :"habitats", votes: 1}, {title :"pets", votes: 5} ] }

I want to build a function that receives title as parameter, and increments votes by one, with no success.

I am trying things like :

const docRef = doc(db, "questions", id);

await updateDoc(docRef, {
        topics: {
          name: topicName,
          vote: increment(1),

//with arrayUnion

await updateDoc(docRef, {
        topics: arrayUnion{
          name: topicName,
          vote: increment(1),

But the only thing I do is updating the array replacing the two objects with just a new one, or adding a new object to the two existing ones.