Record some problems encountered in the project .
import numpy as np
a = np.array((0.2,0.5,0.9,1.5))
Yes a To transpose :
import numpy as np
a = np.array((0.2,0.5,0.9,1.5))
a_new = a.reshape(1,4)
import numpy as np
import pandas as pd
a = np.array((0.2,0.5,0.9,1.5))
a_new = a.reshape(1,4)
df_a = pd.DataFrame(a_new)
Change column names :
import numpy as np
import pandas as pd
a = np.array((0.2,0.5,0.9,1.5))
a_new = a.reshape(1,4)
df_a = pd.DataFrame(a_new)
df_a.columns = ['a', 'b', 'c', 'd'] # Name
import numpy as np
import pandas as pd
a = np.array((0.2,0.5,0.9,1.5))
a_new = a.reshape(1,4)
df_a = pd.DataFrame(a_new)
df_a.columns = ['a', 'b', 'c', 'd'] # Name
# DataFrame turn jason
df_a_new = df_a.to_json(orient="columns")
stay df_a The order of columns in is a、b、c、d
The order we need now is d、b、c、a
import numpy as np
import pandas as pd
a = np.array((0.2,0.5,0.9,1.5))
a_new = a.reshape(1,4)
df_a = pd.DataFrame(a_new)
df_a.columns = ['a', 'b', 'c', 'd'] # Name
df_a_p = df_a[["d","b","c","a"]]
attach , Give away one
Splicing DataFrame,A,B,C, D four DataFrame
ABCD = pd.concat([A,B,C, D], axis=1)
Reference resources :
https://blog.csdn.net/qq_27328197/article/details/113823989