Is there a way to get historical tick data from yfinance? I want to analyze a stock in 10 second intervals but I can only access daily data.
Related
I have a Plotly express animated scatter plot, which plots variable 1 (INFLATION) against variable 2 (GROWTH) for every year (TIME) and every country (LOCATION) and then iterates through the years (that's the animation).
def create_plot(self):
fig = px.scatter(self.yoy2,
x="GROWTH",
y="INFLATION",
color="LOCATION",
animation_frame="TIME",
#animation_group="TIME",
size='GDP',
text="LOCATION",
hover_name="LOCATION",
range_y=[-2,12],
range_x=[-15,15],
labels={
"GROWTH": "Growth measured in QGDP PC_CHGPP",
"INFLATION": "INFLATION measured in AGRWTH",
"TIME": "Year"},
title=f"Growth versus Inflation plotter for OECD countries.",
template='none')
I would like to add historic data as shadows to the scatter. So for example there is the scatter of 2021 showing the variables growth and inflation for every country, then I would like to also show the scatter of 2020 with the same colours, and every country point of 2021 connected to their country point in 2020 with a line (so that you see the year over year evolution).
I tried to draw another scatter on top with a shifted dataframe but that did not work.
And sadly there is no function in plotly itself for this.
How could I achieve this?
i'm trying to plot against time but the time in my dataframe has become the index
is there a way to plot against the index?
I was given the following task: "Make a histogram plot with 30 bins for the selected daily mean temperatures using all data of the years 1981-2010. Then repeat this and add a histogram into the same plot for the daily mean temperatures of the years 1961-1990."
I have my avgt and yearly data imported. I know how to plot avgt.
plt.hist(avgt, bins=30, edgecolor='black')
plt.xlabel('Average T')
plt.ylabel('Times Occured')
But how do I get it to just be within the years of 1981-2010. They are part of the same dataset I believe.
So I am plotting to visualize the education difference between genders in a given dataset.
I group the employees by gender, summing their years_in_education with this code
df1 = df[["gender","years_in_education"]] #creating a sub-dataframe with only the columns of gender and hourly wage
staff4=df1.groupby(['gender']).sum() #grouping the data frame by gender and assigning it to a new variable 'staff4'
staff4.head() #creating a visual of the grouped data for inspection
Then I use a bar chart to plot the difference with this code >>
my_plot = staff4.T.plot(kind='bar',title="Education difference between Genders") #creating the parameters to plot the graph
The graph comes out as this >>
But I observe the that scale of the y-axis is outrageous as the highest year in employment by the data is 30. I intend to adjust the scale to range from 0 - 30. I did that using my_plot.set_ylim([0,30]) and the result of that was >>
This graph is not reflective of the data as shown in the first. What can I do to change that?
Any ideas pls? How can I also change the orientation of the label on the y-axis.
I have a plot with hourly values for 2019. When plotting with a sub-set of dates (January only) on the x-axis, my plot goes blank.
I have a DF that I group on the row-axis based on Months and Hours from the time index, for a specific column 'SE3'. The grouping looks good.
Now, I want to plot. The plot looks potentially good, but I want to zoom in on one month only. Based on another post on stackoverflow, I use set_xlim.
Then my plot does not show anything.
#Grouping of DF
df['SE3'].groupby([df.index.month, df.index.hour]).mean().round(2).head()
Picture of grouped DF1
#Plotting and setting new, shorter in time x-axis
ax=df['SE3'].groupby([df.index.month, df.index.hour]).mean().round(2).plot()
ax.set_xlim(pd.Timestamp('2019-01-01 01:00:00'), pd.Timestamp('2019-01-31 23:00:00'))
The expected result is to show the same plot, but now only for January. Instead the grap goes blank. However, the Out data shows
(737060.0416666666, 737090.9583333334), which seems to be date data.
Picture without set_xlim
enter image description here
Picture with set_xlim (empty)
enter image description here
My final aim when I understand why my plot is blank, is to show hourly averages for each month, like this:
enter image description here