I am learning Python on, perhaps real case scenarios, and got a task to filter names of companies which contain more than 3 words. It is in the column named "Company Name" and dataframe is called "data". I managed to get them into the list and eventually also into dataframe. However, in dataframe I found rows at place of columns, and columns at rows. Feels like walking around it.
a,b = data.shape
required_data = []
for i in range(a):
if data["Company Name"][i].count(" ") >= 2:
required_data.append(data.iloc[i])
else:
pass
required_data1 = pd.concat(required_data, axis=1, ignore_index = True)
required_data1
I would go for axis=0
argument, but it returns, sort of, weird list of items from dataframe. Not sure if this is the right approach and so decided to reach out for the help. Many thanks!