adding a new colume to dataframe with the same values of row index - pandas

i want to draw the graph which use the values of a column that used for the GROUPBY.
that particular colume is shown outside the dataframe. so when I am trying to draw graphs I cant able to use that colume. when I use the column name its shows a 'key error'
can I use the first colume, (which is shown outside the dataframe when looking the variable explorer ) for plotting a scatter plot.
or is there is any option to add that colume to a new column as the dataframe?
thanks in advance.

Related

Grouped Bar Plot with Multiple Numeric Fill Variables

I'm used to creating grouped bar plots like this:
new_data<-data%>%
mutate(new_variable=ifelse(variable<100, "Low", "High"))
ggplot(gap,aes(x=random_variable, fill=new_variable))+geom_bar()
Basically I create an additional column that distinguishes any numeric value in the original column I'm using for this example called "variable," and then using "ifelse" it knows how to categorize the new column called "new_variable"
However, can someone please help me separate the fill into three or more levels, for example:
<10, 10-19, 20-59, 50-100, >100
and then generate a grouped bar plot with multiple filled variables based on these numeric conditions?

how to make my column names in one line in the pandas dataframe?

I have a general question related to pandas dataframe:
when I read my file, I found that my column's name is in two lines instead of one line, which makes me can't get the all column names. How to adjust it to make it all in one line?
enter image description here
if I want to assign all my column names to a variable named "columns", is this correct?
columns = data.columns
columns

Insert chart series into specific index location

I need to add a chart series into a specific location, such as 5 series available at the moment and i need the latest series be in the 3rd position.
i tried the chart1.series.insert(2,'series(5)') function, but it always return me : "A chart element with the name 'XXX' already exists in the 'SeriesCollection'."
It is due to i have to create the series before I insert since the insert function require the position and the series that need to insert.
Is there any misuse of this function by me or any better way to insert the chart series rather than this?
I don't think this has something to do that the series does not exist, at least that is not what the exception is saying.
It seems that all names in your Series in your chart have to be unique. So you have ensure that when you insert another Series.

How to pivot a line graph in SSRS

I have the following dataset:
Which creates the following line graph with Roletype as the category group and experience as the value:
How can I pivot this graph so Roletype is on the y axis and values are on the x axis?
I think you are actually using an area chart rather than a line chart, but both function the same way. The y-axis measures a numerical value. You indicate what is on the y-axis by placing something in the values area. If you use a field that isn't a number, it's going to try to sum it or count it or aggregate it in some way. You should use a different chart type to effectively display non-numerical data (see this article about choosing the correct chart type). If you want to assign values to your role-types and then display the description on the axis you could do that. I wouldn't necessarily recommend it as an effective way to communicate your message.
To show use the values for the y-axis, add the role-type values field to your dataset. Use that in the values for your chart and aggregate by avg. Follow the instructions in the accepted answer here. You basically set the number type for your vertical axis labels to custom and then add the list of possible values. This only works if you know exactly what values you are expecting.

Combining data from different columns into a line graph with SSRS

Hi I am new to SSRS and I am trying to create a line graph from the following dataset that has a single line and I am confused with how to achieve this simple task.
column1|column2|column3
1,11,35
If I try and add column 1-3 as values it will show nothing because it is trying to do a separate line per column.
I have tried making a temp table in sql and reformatting it as follows:
values
1
11
35
This works however this causes me to lose the axis names for each value.
How can I achieve a single line in my line graph as well as keeping the axis names?
You're correct in that you need separate rows (i.e. pivoting your data) to meet your chart requirements.
You can need to add another column to your new Dataset to have group names, too:
Just example names, obviously.
In your chart, add the Series and Category as required:
Now you have labels on the axis: