3

You could break the column 2 from your example into number of columns : Image,Video.... So the new features will be like: Column1 Image Video Google 0 0 Google 0 0 Facebook 1 0 Facebook 0 1


2

First, we must understand about a common statistical term called population. Given a population say X, a random sample is drawn (in the ideal conditions). Now suppose you are asked to build a predictive model based on this random sample. So, you split the sample into train, test and validation sets. And you start to build the model on the train set. You ...


2

This solution would be performant only if your values has an order. Some models use as learning function the distance between points, and if you use your method, a student in Math and a student in English (0 and 2 making a 2 distance) will have more distance than a student in Math and a student in Science (0 and 1 making a 1 distance). Using this method ...


2

data.loc[ data['age'].isin(range_1) & data['height'].isin(range_2) ]


2

Missing values doesn't necessarily mean missing information. Sometime missing value represent an information in itself. For example: we have a data set which have features such as pool area, no. Of rooms and area. Now pool area have 90% of its value missing. You can create a new column called is_pool, which tells if the house has pool or not, from pool area ...


1

When you read the two csv files and store the data in two dataframes, you could then combine it into one dataframe, do the dropna and then split it back. I will give an example using pandas import pandas as pd df1 = pd.read_csv('test_data.csv') df2 = pd.read_csv('submission_data.csv') df3 = pd.concat([df1, df2], axis=1) # this will combine the two dfs. ...


1

I dont think there is one correct way, but what you can do is Use PCA if you have many features. This will reduce some number of features based on the amount of variance in each feature. You may use other dimensionality reduction techniques. You can use models like Lightgbm or random forest and know which feature are important. 3. You may use Lasso ...


1

I suggest adding a company name for each corresponding month. See the attached picture. The formula for the first column determined if it is for a month or for the company name. Assuming that all your months are in the three-letter format and there is no company named 'May' or 'Sep', the formula for the cell B2 would be =SUMPRODUCT(--(A2={"Jan",&...


1

If the Train data(~80%) doesn't have any missing records and you are expecting missing records in test data(~20%). This can happen in these circumstances(can be other too) - Only few missing records in the count - Then these are most probably completely at random, then you can either remove the records or fill with the mean/median of training data A Good ...


1

You can try this: import pandas as pd df_new = pd.get_dummies(df, columns=['column2']) print(df_new) Output: column1 column2_Image column2_Video 0 Google 0 0 1 Google 0 0 2 Google 0 0 3 Google 0 0 4 Facebook 1 ...


1

There are many methods to connect two different kinds of datasets Python Pandas - Merging/Joining left − A DataFrame object. right − Another DataFrame object. on − Columns (names) to join on. ... left_on − Columns from the left DataFrame to use as keys. ... right_on − Columns from the right DataFrame to use as keys. ... left_index − If True, use the index (...


1

You can use inner join: import pandas as pd df1 = pd.read_csv('file1.csv') df2 = pd.read_csv('file2.csv') df = pd.merge(df1, df2, on="Column1", how="inner")


Only top voted, non community-wiki answers of a minimum length are eligible