Category : dataframe

I have following code that prints the output on console, But along with follower and friend account name, I need the screenname of the user account. Following code works well for one screen_name provided I need to collect follower and following account for multiple users along with screenname of user. for user in tweepy.Cursor(api.followers, screen_name="Billgates").items(): ..

Read more

I’m working with a huge dataframe in python and sometimes I need to add an empty row or several rows in a definite position to dataframe. For this question I created a small dataframe df in order to show, what I want to achieve. cars = {‘Brand’: [‘Honda Civic’,’Toyota Corolla’,’Ford Focus’,’Audi A4′], ‘Price’: [22000,25000,27000,35000] } ..

Read more

Imagine you have the following df: dffinal = {‘BTW’: ‘2.81’, ‘ExclBTW’: ‘31.17’, Totaal: ‘33.98’} BTW ExclBTW Totaal 0 2.81 31.17 33.98 dtype: I want to do a reconciliation check on these numbers, such that Totaal equals ExclBTW + BTW: dffinal[‘VATcheck’] = np.where(dffinal[‘Totaal’].astype(‘float’) == (dffinal[‘ExclBTW’].astype(float).round(2) + dffinal[‘BTW’].astype(float).round(2)), True, False) However, the VATcheck returns False, while 2.81 ..

Read more