How to convert images to video? Convert img??? sequence to a video. 3 images per second. ??? start from 000,001,… How to add audio to video (no added original audio)? Audio shorter than video, after video ended audio continue to play. Add shortest, to cut audio to same length..
Category : Uncategorized
start_date=dataWorld.index[0] end_date=dataWorld.index[-1] dateData=pd.date_range(start=start_date,end=end_date) dataWorld[‘Date’]=dateData dataWorld=dataWorld.set_index(‘Date’) forecastDays=60 dateForecast= pd.date_range(start=end_date,periods=forecastDays+1)[1:] dateObsForecast=dateData.append(dat..
fig=plt.figure(figsize=(18,18)) ax = plt.gca() theRatios.plot(kind=’line’,x=’date’,y=’ratioCA’,color=’red’,ax=ax) theRatios.plot(kind=’line’,x=’date’,y=’ratioDailyCA’,color=’red’,linestyle=’dashed’, ax=ax) theRatios.plot(kind=’line’,x=’date’,y=’ratioON’,color=’blue’,ax=ax) theRatios.plot(kind=’line’,x=’date’,y=’ratioDailyON’,color=’blue’,linestyle=’dashed’, ax=ax) plt.title(‘COVID-19 case ratio of test (%)’) plt.xlabel(‘Date’) plt.ylabel(‘Percent(%)’) plt.grid(color=’k’, linestyle=’-‘, linewidth=0.1) ..
By columns df.sort_values(by=[‘col1’]) df.sort_values(by=[‘col1’, ‘col2′]) df.sort_values(by=’col1′, ascending=False) df.sort_values(by=’col1′, ascending=False, na_position=’first’) By rows 0 col1 col2 col3 row1 222 16 23 row2 333 31 11 row3 444 34 11 df.sort_values(by=’row2′,axis=1) output: 0 col1 col2 col3 row1 23 16 222 row2 11 31 333 row3 11 34 444 df.sort_values(by=’row2′,axis=1,ascending=False) output: 0 col1 col2 col3 row1 222 16 ..
list0=[‘Confirmed Cases’,’Recovered Cases’, ‘Deaths Reported’,’Active Cases’] def Reverse(lst): return [ele for ele in reversed(lst)] list1=Reverse(list0) list1 [‘Active Cases’, ‘Deaths Reported’, ‘Recovered Cases’, ‘Confirm..
Replace NaN in dataframe with ” df_confirmed = df_confirmed.replace(np.nan, ”, regex=True) Fill NaN with another column Day col1 col2 1 1 a 2 NaN b df[‘col1’].fillna(df[‘col2’]) Day col1 col2 1 1 a 2 b b Replace NaN with 0 df[‘DataFrame Column’] = df[‘DataFrame Column’].fillna(0) Replace all NaN in df df..
import os path=’COVID-19-master/csse_covid_19_data/csse_covid_19_time_series’ confirmed_fn=os.path.join(path,’time_series_covid19_confirmed_global.csv’) confirmed_fn ‘COVID-19-master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_g..
df.select(‘_c1’).distinct().show(5,truncate=False) +——————+ |_c1 | +——————+ |Chad | |Anguilla | |Paraguay | |Yemen | |State of Palestine| +——————+ only showing ..
from pyspark.sql import SparkSession spark=SparkSession.builder.appName(‘creditcard_data_processing’).getOrCreate() fn = “SYB62_123_201907_Total.csv” df=spark.read.csv(fn,header=True,inferSchema=True) df.sample(False,0.1,seed=250.0).limit(5).select(‘_c1′,’Series’,’Value’).show(truncate=False) +—————————–+————————————————+————–+ |_c1 |Series |Value | +—————————–+————————————————+————–+ |Total, all countries or areas|Exports FOB (millions of US dollars) |5050237.9273 | |Total, all countries or areas|Exports FOB (millions of US dollars) |1.5843502717E7| |Africa |Exports FOB (millions of US dollars) |397465.322 | |Africa |Balance imports/exports (millions of US dollars)|-10892.3263 ..
date difference: example 1: def dd(date1,date2): d1 = datetime.strptime(date1,’%m/%d/%y’) d2 = datetime.strptime(date2,’%m/%d/%y’) diffDays = (d1-d2).days return diffDays example 2: from datetime import datetime, timedelta ini_time_for_now = datetime.now() future_date_after_2yrs = ini_time_for_now + timedelta(days = 730) future_date_after_2days = ini_time_for_now + timedelta(days = 2) past_date_before_2yrs = ini_time_for_now – timedelta(days = 730) past_date_before_2hours = ini_time_for_now – timedelta(hours = 2) ..