There are several types of No.Fy Arrays and sequences of Arrays
by appending to another listRead one number array to save the sequence.
Read the next number array again and save the sequence again
When you want to label a list of thousands of elements
Here, one number array sequence has the same label value.
I wonder if there is a good way.
numpy label
Is it roughly the same situation as below? Please refer to it.
import numpy as np
import pandas as pd
np.random.seed(1)
def read_dogs():
return np.random.rand(100, 4)
def read_cats():
return np.random.rand(50, 4)
dog data = read_dogs()
Cat data = read_cats()
dog data frame = pd.DataFrame (dog data, columns = "height, weight, forefoot length, tail length").split(","))
dog data frame ["type"] = "dog"
Cat data frame = pd.DataFrame (cat data, columns = "height, weight, forefoot length, tail length").split(","))
Cat Data Frame ["Type"] = "Cat"
Dog Cat Data Frame = pd.concat ([dog data frame, cat data frame], axis=0, ignore_index=True)
print (Dog Cat Data Frame.sample(5).to_markdown())
© 2024 OneMinuteCode. All rights reserved.