Linked Questions
3,518 questions linked to/from How to make good reproducible pandas examples
1
vote
1
answer
691
views
Sometimes it is necessary to show my dataframe to properly ask the question. How can I do that? [duplicate]
I need to ask a question related to a DataFrame. I tried to add screenshots before but I got -3 reputation and it says I am not allowed to upload the image. What is the best way then. I am new to ...
3
votes
1
answer
487
views
How to load a dataframe from a printed dataframe string? [duplicate]
Often people ask questions on Stack Overflow with an output of print(dataframe). It is convenient if one has a way of quickly loading the dataframe data into a pandas.dataframe object.
What is/are ...
1
vote
1
answer
344
views
Provide sample DataFrame from csv file [duplicate]
when asking a python/pandas question on stackoverflow I often like to provide a sample dataframe.
I usually have a local csv file I deal with for testing.
So for a DataFrame I like to provide a code ...
1
vote
0
answers
355
views
Best way to insert dataframe into stackoverflow question [duplicate]
I’m regularly searching stackoverflow for pandas and Python wisdom. (Plenty here). But to better setup my pandas questions I’m left to manually inserting sample data in a sample dataframe illustrating ...
2463
votes
23
answers
489k
views
How to make a great R reproducible example
When discussing performance with colleagues, teaching, sending a bug report or searching for guidance on mailing lists and here on Stack Overflow, a reproducible example is often asked and always ...
314
votes
17
answers
568k
views
Pandas percentage of total with groupby
This is obviously simple, but as a numpy newbe I'm getting stuck.
I have a CSV file that contains 3 columns, the State, the Office ID, and the Sales for that office.
I want to calculate the percentage ...
286
votes
19
answers
511k
views
Find difference between two data frames
I have two data frames df1 and df2, where df2 is a subset of df1. How do I get a new data frame (df3) which is the difference between the two data frames?
In other word, a data frame that has all the ...
216
votes
5
answers
192k
views
Find the column name which has the maximum value for each row
I have a DataFrame like this one:
Communications and Search Business General Lifestyle
0 0.745763 0.050847 0.118644 0.084746
0 0.333333 0.000000 0.583333 0.083333
0 0....
76
votes
12
answers
34k
views
R expand.grid() function in Python
Is there a Python function similar to the expand.grid() function in R ? Thanks in advance.
(EDIT) Below are the description of this R function and an example.
Create a Data Frame from All ...
87
votes
6
answers
158k
views
ValueError: Grouper for <something> not 1-dimensional
I'm have the following code which creates a table and a barplot via seaborn.
#Building a dataframe grouped by the # of Engagement Types
sales_type = sales.groupby('# of Engagement Types').sum()
#...
83
votes
4
answers
10k
views
How to make good reproducible Apache Spark examples
I've been spending a fair amount of time reading through some questions with the pyspark and spark-dataframe tags and very often I find that posters don't provide enough information to truly ...
57
votes
5
answers
3k
views
Python's equivalent for R's dput() function
Is there any function in python similar to dput() function in R?
26
votes
3
answers
280k
views
Extracting specific columns from pandas.dataframe
I'm trying to use python to read my csv file extract specific columns to a pandas.dataframe and show that dataframe. However, I don't see the data frame, I receive Series([], dtype: object) as an ...
21
votes
8
answers
65k
views
Pandas select all columns without NaN
I have a DF with 200 columns. Most of them are with NaN's. I would like to select all columns with no NaN's or at least with the minimum NaN's. I've tried to drop all with a threshold or with notnull()...
23
votes
4
answers
118k
views
Write values to a particular cell in a sheet in pandas in python
I have an excel sheet, which already has some values in some cells.
For ex :-
A B C D
1 val1 val2 val3
2 valx valy
I want pandas to ...