Category : dataframe

I would like to return several dataframes from def function using unique names based on variables. My code as follows: def plots_without_outliers(parameter): """ The function removes outliers from dataframe variables and plots boxplot and historams """ Q1 = df[parameter].quantile(0.25) Q3 = df[parameter].quantile(0.75) IQR = Q3 – Q1 df_without_outliers = df[(df[parameter] > (Q1-1.5*IQR)) & (df[parameter] < ..

Read more

I have a series of stock prices for about 2500 days. I want to plot a best-fitting line for a period of 3 months and then calculate the slope of this best-fitting line. I tried two approaches before asking this question:- Using np.polyfit def getEODData(symbol,shorttimeframe): api_result = requests.get(‘http://api.marketstack.com/v1/eod?access_key=’+apikey+’&symbols=’+symbol+’&limit=1000’) api_response = api_result.json() df=pd.DataFrame.from_dict(api_response[‘data’]) time1=timeconversion_1day[shorttimeframe] last=len(df) if ..

Read more

My program returns me a dictionary that has several layers. Drawing in Excel, it looks like this: Excel Template The code returns this dictionary (it is already organized to help you visualize): {‘Parity’: ‘BITCOIN / TETHERUS’, ‘1m’: {‘Datas’: {‘Price’: {‘Initial Price’: ‘58239.43’, ‘Final Price’: ‘58236.50’}, ‘Oscillators’: {‘Buy’: 1, ‘Neutral’: 8, ‘Sell’: 2}, ‘MovingAverages’: {‘Buy’: 6, ..

Read more