# How to graph the data accumulation of an existing variable in the code in python

52
January 24, 2022, at 12:20 PM

Good afternoon, I'm learning python and I am making some graphics with a file with data, dates and times My first goal was to graphic the data vs time, Magnitude vs Fulltime, only Saturday and Sundays (d2 and w) vs time, and only the 11pm to 12md of Business Day (Hour and d4) vs time. And with all the happiness I did it. Now my second goal is to make another curve in ax[0,1].plot(w) and ax[1,1].plot(d4), but now with the accumulation of the data in w and d4. I know how to do another curve an existing graph, but i don't know how to plot the accumulation of the data in a variable like w and d4. How can I do it? Also if you see some things in Spanish, is because I live in Costa Rica.

``````fecha, hora, mag = np.loadtxt("Cat2019.event.cat", usecols=(0, 1, 5), unpack=True,
dtype="str")
mag = mag.astype(np.float)
Fulltime=[]
for i,f in enumerate(fecha):
temp = f'{f}T{hora[i]}'
temp2 = datetime.datetime.strptime(temp, '%Y%m%dT%H%M%S%f')
Fulltime.append(temp2)
ts = pd.Series(np.random.randint(0, 50, len(Fulltime)), index=Fulltime)
#Every Day
d = ts.resample('D').count()
#Now for Saturdays and Sundays
d2 = ts.resample('D').count()
w = d2[d2.index.dayofweek.isin([5,6])]
#Now for 23pm to 12md only in Business Days
Hour = ts.between_time("23:00", "12:00")
d4= Hour.resample("B").count()
Graphics
ax[0,0].plot(d)
ax[1,0].scatter(Fulltime, mag, s=1.0)
ax[0,1].plot(w)
ax[1,1].plot(d4)
``````

Thank you

POPULAR ONLINE

### pyDatalog program fails on on Android Pydroid3 platform

I can't get the Python program at https://githubcom/pcarbonn/pyDatalog/blob/master/pyDatalog/examples/graph

114

im trying to add a segmented tab to my header let me show you an example before i start

93

### How to use jQuery.Lazy() Plugin with hash Image Tag Helper asp-append-version (in asp.net core)

I am having a problem configuring jQueryLazy() to work with images that have been appended with a hash

96

### How to convert PHP preg_replace_callback to C#?

I have such a code in PHP, but I need to rewrite it in C#Suggest any options please

87