Skip to content

Tag: pandas

How to skip apply function for missing value cell in pandas

I have a Dataset as below : I write the code to calculate networkdays for these row have date value in column ‘End Date’ : however, I got the error below, I don’t know how I got this, could you please help look ? my expect output like below: Answer I believe the problem comes from how you ca…

How to map list of string to existing list of integer?

I have this string vocab file: https://drive.google.com/file/d/1mL461QGC5KcA3M1r8AESaPjZ3D_ufgPA/view?usp=sharing. I have this sentences file, made from all vocab file above: https://drive.google.com/file/d/1w5ma4ROjyp6xmZfvnIQjsdH2I_K7lHoo/view?usp=sharing. I want to map every sentences into its correspondin…

Labeling sentences from different nested dictionaries

I created a function to extract sentences from a specific key in a nested file. Now I would like to include in this function a label each time it comes to a new dictionary. Each time the the value HEADER appears marks the begining of a NEW story. So I would like to label the sentences that belong to the

How to sum a value based on group?

I am trying to figure out how to sum a value from rank 5 to the LOWEST rank (I.E. 5-1,000) for each geography in my dataframe. However, I am getting the error: ‘DataFrameGroupBy’ object has no attribute ‘iloc’ Am I using iloc incorrectly? Answer IIUC, try: