Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 77338

Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).

3 votes
Accepted

Converting a Pandas Series string of multiple attributes into individual attributes?

This might Pandas convert a column of list to dummies. You can try using the MultiLabelBinarizer class from sklearn.
Daren's user avatar
  • 186
0 votes

Compare multiple values from a DataFrame against a single row from another

You can join df and df_st on Reference: df_merged = pd.merge(df, df_st, on="Reference", how="left") Note: The how="left" would really depend on what you want in the joined table. You can then compare …
Daren's user avatar
  • 186
1 vote
Accepted

How to find the mean of a column relative to another column?

You need to change inplace to False (which is the default). Setting it to True changes the dataframe in place, so you don't have to assign the column again. Also, setting inplace=True returns None. S …
Daren's user avatar
  • 186
2 votes
Accepted

How to display the entire output and not shortened versions

Alternatively to Marce's answer, you can display all the rows without finding N by using: with pd.option_context("display.max_rows", -1): display(train.isnull().sum())
Daren's user avatar
  • 186
1 vote

How do I assign specific values to categorical variables

Building on to @grov's answer, you can alternatively use map directly on the column like so: df['col1_numerical'] = df['col1'].map({ "Increased": 1, "Decreased": -1, "Neutral": 0 })
Daren's user avatar
  • 186