Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

concatenating ols model results

df = pd.read_csv("df.csv", sep=";")
df_coef =[]
status = list(set(df['status']))
for status in status:
    df_redux = df[df['status']==status]
    X = df_redux[['a', 'b', 'c', 'd']]
    Y = df_redux['y_Values']

    model = sm.OLS(Y, X).fit()
    predictions = model.predict(X)
    stats_2 = pd.read_html(model.summary().tables[1].as_html(),header=0,index_col=0)[0]
    predictions = pd.DataFrame(predictions, columns = ['predictions'])
    gf = pd.concat([predictions, df_redux], axis=1)
    df_coef.append(gf)

all_coef = pd.concat(df_coef)
Comment

PREVIOUS NEXT
Code Example
Python :: How to know position on Kivy 
Python :: calculate time between datetime pyspark 
Python :: pyglet template 
Python :: sklearn mahalanobis distance 
Python :: def get_context_data(self, **kwargs): 
Python :: hack twitter with python 
Python :: print("ola") 
Python :: for count in range(size): 
Python :: how to add numbers in a list python 
Python :: Create an identical list from the first list using list comprehension. 
Python :: series clip 
Python :: splitting x,y using iloc 
Python :: nlp generate parse tree in python 
Python :: how to discover which index labels are in other 
Python :: napalm cli 
Python :: comment arrĂȘter un jeu en appuyant sur une touche python 
Python :: call for a last number in series python 
Python :: medium how to interact with jupyter 
Python :: python amino acid dictionary 
Python :: Percentage change between the current and the prior element. 
Python :: Warning message: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : EOF within quoted string 
Python :: fibonci in python 
Python :: get the values of your aws tags from ec2 instance 
Python :: RuntimeError: cuda runtime error (711) : peer mapping resources exhausted at /pytorch/aten/src/THC/THCGeneral.cpp:139 
Python :: python date_end-date_Start in seconds 
Python :: invalid literal for int() with base 10 python 
Python :: pseudo-random input signal python 
Python :: special characters in python 
Python :: python autoLibrary 
Python :: str vs rper in python 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =