few short codes.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 f= open("pg37431.txt")

text= f.read()

print(text)

............................................................................

output:

veatdughjpjujhig

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

file=open("pg37431.txt")

text=file.read(5)

print(text)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 this is how to write a text file.
...........................................
file=open("annielog.txt",'w')
file.write("hi there i am animesh\n hope you are doing well /nsmart")

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

temperature=[14.2, 16.4, 11.9, 12.5, 18.9, 22.1, 19.4, 23.1, 25.4, 18.1, 22.6, 17.2]
sales = [215.20, 325.00, 185.20, 330.20, 418.60, 520.25, 412.20, 614.60, 544.80, 421.40, 445.50, 408.10]
plt.scatter(temperature,sales, color="orange")
plt.title("ice temperature versus sales")
plt.xlabel('ice temperature')
plt.ylabel('icecream sales')
plt.show

output....................................

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
labels = ['Monica', 'Adrian', 'Jared']
num = [230, 100, 98]
plt.pie(num,labels=labels,autopct='%1.1f%%',colors=['lightblue','yellow','green'])
plt.title("piechart of label", fontdict={'fontsize':31})
plt.show




import seaborn as sns
data = [90, 80, 50, 42, 89, 78, 34, 70, 67, 73, 74, 80, 60, 90, 90]
sns.distplot(data)
plt.title("Data density",fontdict={'fontsize':31})
plt.xlabel("score",fontdict={'fontsize':15})
plt.ylabel("density",fontdict={'fontsize':15})

plt.show()
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.............................................................................................................
counterplot

weight=[85.08,79.25,85.38,82.64,80.51,77.48,79.25,78.75,77.21,73.11,82.03,82.54,74.62,79.82,79.78,77.94,83.43,73.71,80.23,78.27,78.25,80.00,76.21,86.65,78.22,78.51,79.60,83.88,77.68,78.92,79.06,85.30,82.41,79.70,80.16,81.11,79.58,77.42,75.82,74.09,78.31,83.17,75.20,76.14]
sns.kdeplot(list(range(1,45)),weight,kind='kde', cmap="Reds")


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#two plot at same time
fig= plt.figure(figsize=(8,4))
ax1=fig.add_subplot(122)
ax2=fig.add_subplot(121)

labels = ['Adrian', 'Monica', 'Jared']
num = [230, 100, 98]
ax1.pie(num, labels=labels, autopct='%1.1f%%', colors=['lightblue', 'lightgreen', 'yellow'])
ax1.set_title('Pie Chart (Subplot 1)')
#Now, plot the second subplot, which is a bar chart:

# Plot Bar Chart (Subplot 2)
labels = ['Adrian', 'Monica', 'Jared']
num = [230, 100, 98]
plt.bar(labels, num, color=['lightblue', 'lightgreen', 'yellow'])
ax2.set_title('Bar Chart (Subplot 2)')
ax2.set_xlabel('Candidate')
ax2.set_ylabel('Votes')
fig.suptitle('Voting Results', size=14)

::::::::::::::::::::::::::::::::::::::::::::::::::::
#add new df

df_new=pd.DataFrame({'Quiz1':[np.NaN],'Quiz2':[np.NaN],'Quiz3':np.NaN,'Quiz4':[45]},index=["Adrian"])
#df=pd.concat([df,df_new])
df_new
:::::::::::::::::::::::::::::::::::::::::::
#for chancing datatype
df.Quiz4.astype(float)

Comments

Popular posts from this blog

Pcb Fault Detection(Deep Learning Technique)

using your age and duration of workout finding how much calories you burned!

list of keyword in python