From 58256885f0d81bccecc3de9813050d7871f9acbc Mon Sep 17 00:00:00 2001 From: rakesh Date: Sun, 29 Dec 2019 23:24:46 +0530 Subject: [PATCH] prime number --- ExceptionHandling/Try_else.py | 8 + Loops/binary_decinal.py | 12 + Loops/decimal_binary.py | 10 + Loops/tempCodeRunnerFile.py | 21 +- Projects/sudoku_solver.py | 83 ++++++ .../delete All File with extension_EXE.py | 22 +- functions/addition_fun.py | 14 + functions/armstrong.py | 14 + functions/armstrong_range.py | 17 ++ functions/check_prime.py | 15 + functions/passing_list.py | 12 + functions/positional_arguments.py | 12 + functions/prime_number.py | 16 + functions/prime_number_in_range.py | 22 ++ functions/tempCodeRunnerFile.py | 23 +- json/import_json.py | 4 + matplotlib/bar_Graph.py | 13 +- matplotlib/line_graph.py | 11 +- matplotlib/tempCodeRunnerFile.py | 9 + .../Untitled1-checkpoint.ipynb | 6 + .../Untitled2-checkpoint.ipynb | 6 + pandas/Untitled1.ipynb | 62 ++++ pandas/Untitled2.ipynb | 278 ++++++++++++++++++ pandas/p1.py | 2 +- websites.py | 13 +- 25 files changed, 646 insertions(+), 59 deletions(-) create mode 100644 ExceptionHandling/Try_else.py create mode 100644 Loops/binary_decinal.py create mode 100644 Loops/decimal_binary.py create mode 100644 Projects/sudoku_solver.py create mode 100644 functions/addition_fun.py create mode 100644 functions/armstrong.py create mode 100644 functions/armstrong_range.py create mode 100644 functions/check_prime.py create mode 100644 functions/passing_list.py create mode 100644 functions/positional_arguments.py create mode 100644 functions/prime_number.py create mode 100644 functions/prime_number_in_range.py create mode 100644 json/import_json.py create mode 100644 matplotlib/tempCodeRunnerFile.py create mode 100644 pandas/.ipynb_checkpoints/Untitled1-checkpoint.ipynb create mode 100644 pandas/.ipynb_checkpoints/Untitled2-checkpoint.ipynb create mode 100644 pandas/Untitled1.ipynb create mode 100644 pandas/Untitled2.ipynb diff --git a/ExceptionHandling/Try_else.py b/ExceptionHandling/Try_else.py new file mode 100644 index 0000000..406876c --- /dev/null +++ b/ExceptionHandling/Try_else.py @@ -0,0 +1,8 @@ +a = 10 +b = int(input("Enter any number ")) +try: + c = a/b +except: + print('Cannot divide NUMBER by STRING') +else: + print('Result :', c) diff --git a/Loops/binary_decinal.py b/Loops/binary_decinal.py new file mode 100644 index 0000000..2efb92f --- /dev/null +++ b/Loops/binary_decinal.py @@ -0,0 +1,12 @@ +# program to find out decimal number of any given binary number +# made by : rakesh kumar +n = int(input('Enter any number :')) +sum = 0 +i = 0 +while n != 0: + rem = n % 10 + sum = sum+rem*2**i + n = n//10 + i = i+1 + +print('Decimal Equivalent :', sum) diff --git a/Loops/decimal_binary.py b/Loops/decimal_binary.py new file mode 100644 index 0000000..5e6f5ac --- /dev/null +++ b/Loops/decimal_binary.py @@ -0,0 +1,10 @@ +# program to find out binary equivalent of any decimal number +# made by : rakesh kumar + +n = int(input('Enter any number :')) +l = '' +while(n != 0): + l = str(n % 2) + l + n = n//2 + +print(l) diff --git a/Loops/tempCodeRunnerFile.py b/Loops/tempCodeRunnerFile.py index a8ef623..a6ad39b 100644 --- a/Loops/tempCodeRunnerFile.py +++ b/Loops/tempCodeRunnerFile.py @@ -1,21 +1,2 @@ -# program to find out EMI using formula -# EMI = (p*r(1+r)**t)/((1+r)**t-1) -# made by : rakesh kumar -from math import pow - - -def emi_calculate(p, r, t): - r = r/(12*100) # rate for one month - t = t*12 # one month time - emi = (p*r*pow(1+r, t))/(pow(1+r, t)-1) - return emi - - -if __name__ == "__main__": - p = int(input('Enter pricipal amount :')) - r = int(input('Enter rate of interest :')) - t = int(input('Enter time in years :')) - emi = emi_calculate(p, r, t) - - print('Monthly Installment :%.2f' % emi) + i = i+1 \ No newline at end of file diff --git a/Projects/sudoku_solver.py b/Projects/sudoku_solver.py new file mode 100644 index 0000000..bb47248 --- /dev/null +++ b/Projects/sudoku_solver.py @@ -0,0 +1,83 @@ +board = [ + [7, 8, 0, 4, 0, 0, 1, 2, 0], + [6, 0, 0, 0, 7, 5, 0, 0, 9], + [0, 0, 0, 6, 0, 1, 0, 7, 8], + [0, 0, 7, 0, 4, 0, 2, 6, 0], + [0, 0, 1, 0, 5, 0, 9, 3, 0], + [9, 0, 4, 0, 6, 0, 0, 0, 5], + [0, 7, 0, 3, 0, 0, 0, 1, 2], + [1, 2, 0, 0, 0, 7, 4, 0, 0], + [0, 4, 9, 2, 0, 6, 0, 0, 7] +] + + +def solve(bo): + find = find_empty(bo) + if not find: + return True + else: + row, col = find + + for i in range(1, 10): + if valid(bo, i, (row, col)): + bo[row][col] = i + + if solve(bo): + return True + + bo[row][col] = 0 + + return False + + +def valid(bo, num, pos): + # Check row + for i in range(len(bo[0])): + if bo[pos[0]][i] == num and pos[1] != i: + return False + + # Check column + for i in range(len(bo)): + if bo[i][pos[1]] == num and pos[0] != i: + return False + + # Check box + box_x = pos[1] // 3 + box_y = pos[0] // 3 + + for i in range(box_y*3, box_y*3 + 3): + for j in range(box_x * 3, box_x*3 + 3): + if bo[i][j] == num and (i, j) != pos: + return False + + return True + + +def print_board(bo): + for i in range(len(bo)): + if i % 3 == 0 and i != 0: + print("- - - - - - - - - - - - - ") + + for j in range(len(bo[0])): + if j % 3 == 0 and j != 0: + print(" | ", end="") + + if j == 8: + print(bo[i][j]) + else: + print(str(bo[i][j]) + " ", end="") + + +def find_empty(bo): + for i in range(len(bo)): + for j in range(len(bo[0])): + if bo[i][j] == 0: + return (i, j) # row, col + + return None + + +print_board(board) +solve(board) +print("___________________") +print_board(board) diff --git a/fileHandling/delete All File with extension_EXE.py b/fileHandling/delete All File with extension_EXE.py index f36af00..9805360 100644 --- a/fileHandling/delete All File with extension_EXE.py +++ b/fileHandling/delete All File with extension_EXE.py @@ -1,29 +1,33 @@ -#------------------------------------------------------------------------------- -# Name: Program to delete a particular type of files from selected directory +# ------------------------------------------------------------------------------- +# Name: Program to delete a particular type of files from selected directory # # Author: rakesh # # Created: 05-05-2017 # Copyright: MIT -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------- import os -import sys #module for terminating +import sys # module for terminating import glob import tkinter as tk from tkinter import filedialog + + def main(): root = tk.Tk() root.withdraw() - directory = filedialog.askdirectory() #source folder - count=0 - for root, SubFolders , files in os.walk(directory): + directory = filedialog.askdirectory() # source folder + count = 0 + for root, SubFolders, files in os.walk(directory): os.chdir(root) - files = glob.glob('*.exe') + files = glob.glob('*.nef') # print(files) for filename in files: + print(filename, 'Deleted') os.unlink(filename) - count+=1 + count += 1 print("Total {} files deleted".format(count)) + if __name__ == '__main__': main() diff --git a/functions/addition_fun.py b/functions/addition_fun.py new file mode 100644 index 0000000..23b1800 --- /dev/null +++ b/functions/addition_fun.py @@ -0,0 +1,14 @@ +def addition(a, b=0): + return a+b + + +result = addition(10) +print(result) +result = addition('rakesh', ' You are awesome') +print(result) +result = addition(20, 30.45) +print(result) +result = addition([10, 20, 30], [40, 50, 60]) +print(result) +result = addition((10, 20, 30), (40, 50, 60)) +print(result) diff --git a/functions/armstrong.py b/functions/armstrong.py new file mode 100644 index 0000000..cdf1302 --- /dev/null +++ b/functions/armstrong.py @@ -0,0 +1,14 @@ + +def armstrong(n): + m = n + sum = 0 + while(n != 0): + rem = n % 10 + sum += rem**3 + n = n//10 + return True if sum == m else False + + +if __name__ == "__main__": + n = int(input('Enter any number :')) + print('ArmStrong Number ' if(armstrong(n)) else 'Not a Arm Strong Number ') diff --git a/functions/armstrong_range.py b/functions/armstrong_range.py new file mode 100644 index 0000000..16681d2 --- /dev/null +++ b/functions/armstrong_range.py @@ -0,0 +1,17 @@ + +def armstrong(n): + m = n + sum = 0 + while(n != 0): + rem = n % 10 + sum += rem**3 + n = n//10 + return True if sum == m else False + + +if __name__ == "__main__": + n1 = int(input('Enter first value :')) + n2 = int(input('Enter last value :')) + for x in range(n1, n2+1): + if(armstrong(x)): + print(x) diff --git a/functions/check_prime.py b/functions/check_prime.py new file mode 100644 index 0000000..ba074a2 --- /dev/null +++ b/functions/check_prime.py @@ -0,0 +1,15 @@ +import math as m + + +def check_prime(n): + flag = True + for x in range(2, n//2): + if n % x == 0: + flag = False + + return flag + +if __name__ == "__main__": + n = int(input('Enter any integer number : ')) + result = check2_prime(n) + print("Prime Number " if (result) else '"Not prime Number') diff --git a/functions/passing_list.py b/functions/passing_list.py new file mode 100644 index 0000000..8c086b5 --- /dev/null +++ b/functions/passing_list.py @@ -0,0 +1,12 @@ +def common(l1, l2): + c = list() + for x in l1: + if x in l2: + c.append(x) + return c + + +l1 = [1, 2, 3, 4, 6, 8, 9] +l2 = [2, 4, 6, 7, 9, 10] + +print(common(l1, l2)) diff --git a/functions/positional_arguments.py b/functions/positional_arguments.py new file mode 100644 index 0000000..7991774 --- /dev/null +++ b/functions/positional_arguments.py @@ -0,0 +1,12 @@ +def display(number, msg1="School", msg2="Place"): + print('-----Times :', number, end=" ") + print('-----Message 1 :', msg1*2) + print('-----Message 2 :', msg2) + print('----------------------') + + +display(2, 'DAV', 'Ghaziabad') +display(5) +display("SpringDales") +display(msg2="Modern", number=3) +display(msg2="Modern", msg1=24, number=3) diff --git a/functions/prime_number.py b/functions/prime_number.py new file mode 100644 index 0000000..64aa8f6 --- /dev/null +++ b/functions/prime_number.py @@ -0,0 +1,16 @@ +from math import sqrt + + +def prime_number(n): + flag = True + for x in range(2, int(sqrt(n))+1): + if n % x == 0: + flag = False + return flag + + +if __name__ == "__main__": + if(prime_number(12)): + print('Prime Number') + else: + print('Not a prime Number') diff --git a/functions/prime_number_in_range.py b/functions/prime_number_in_range.py new file mode 100644 index 0000000..13a25fc --- /dev/null +++ b/functions/prime_number_in_range.py @@ -0,0 +1,22 @@ +# program to print the prime numbers between a range of numbers. +# made by : rakesh kumar + + +def check_prime(n): + flag = True + for x in range(2, n//2): + if n % x == 0: + flag = False + + return flag + + +if __name__ == "__main__": + n1 = int(input('Enter the starting number : ')) + n2 = int(input('Enter the Ending number number : ')) + + print('Prime Number between :') + for x in range(n1, n2+1): + result = check_prime(x) + if result: + print(x, end=" ") diff --git a/functions/tempCodeRunnerFile.py b/functions/tempCodeRunnerFile.py index f8f7a0b..aa8cb93 100644 --- a/functions/tempCodeRunnerFile.py +++ b/functions/tempCodeRunnerFile.py @@ -1,17 +1,12 @@ -# program to find out sum of element of a list using recursion -# made by : rakesh kumar - - -def sum_element(l): - if(len(l) == 1): - return l[0] - else: - value = l.pop() - return value+sum_element(l) +def check_prime(n): + flag = True + for x in range(2, n//2): + if n % x == 0: + flag = False + return flag if __name__ == "__main__": - - list1 = [1, 2, 34, 5, 6] - result = sum_element(list1) - print('sum of element :', result) + n = int(input('Enter any integer number : ')) + result = check_prime(n) + print("Prime Number " if (result) else '"Not prime Number') \ No newline at end of file diff --git a/json/import_json.py b/json/import_json.py new file mode 100644 index 0000000..cc3d0f0 --- /dev/null +++ b/json/import_json.py @@ -0,0 +1,4 @@ +import json +import requests +source = requests.get('https://jsonplaceholder.typicode.com/todos/1') +print(source.read()) diff --git a/matplotlib/bar_Graph.py b/matplotlib/bar_Graph.py index 99c3bcc..6851d0b 100644 --- a/matplotlib/bar_Graph.py +++ b/matplotlib/bar_Graph.py @@ -1,8 +1,11 @@ -# program to print scatter graph on the screen +# program to print bar graph on the screen # made by : rakesh kumar import matplotlib.pyplot as plt -x = ['Delhi','Banglore','Chennai','Pune'] -y = [250,300,260,400] -plt.bar(x,y) -plt.show() \ No newline at end of file +x = ['Delhi', 'Banglore', 'Chennai', 'Pune'] +y = [250, 300, 260, 400] +plt.xlabel('City') +plt.ylabel('Sales in Million') +plt.title('Sales Recorded in Major Cities') +plt.bar(x, y) +plt.show() diff --git a/matplotlib/line_graph.py b/matplotlib/line_graph.py index 1271357..fc06b90 100644 --- a/matplotlib/line_graph.py +++ b/matplotlib/line_graph.py @@ -3,7 +3,10 @@ import matplotlib.pyplot as plt import numpy as np -x = ['Delhi','Banglore','Chennai','Pune'] -y = [250,300,260,400] -plt.plot(x,y) -plt.show() \ No newline at end of file +x = ['Delhi', 'Banglore', 'Chennai', 'Pune'] +y = [250, 300, 260, 400] +plt.xlabel('City') +plt.ylabel('Sales in Million') +plt.title('Sales Recorded in Major Cities') +plt.plot(x, y) +plt.show() diff --git a/matplotlib/tempCodeRunnerFile.py b/matplotlib/tempCodeRunnerFile.py new file mode 100644 index 0000000..a1e004b --- /dev/null +++ b/matplotlib/tempCodeRunnerFile.py @@ -0,0 +1,9 @@ +# program to print scatter graph on the screen +# made by : rakesh kumar + +import matplotlib.pyplot as plt +import numpy as np +x = ['Delhi','Banglore','Chennai','Pune','Ghaziabad','Udupi'] +y = [250,300,260,400,599,320] +plt.pie(y,labels=x,autopct='%1.2f',startangle=90,explode=(0,0.1,0,0,0.2,0)) +plt.show() \ No newline at end of file diff --git a/pandas/.ipynb_checkpoints/Untitled1-checkpoint.ipynb b/pandas/.ipynb_checkpoints/Untitled1-checkpoint.ipynb new file mode 100644 index 0000000..2fd6442 --- /dev/null +++ b/pandas/.ipynb_checkpoints/Untitled1-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/pandas/.ipynb_checkpoints/Untitled2-checkpoint.ipynb b/pandas/.ipynb_checkpoints/Untitled2-checkpoint.ipynb new file mode 100644 index 0000000..2fd6442 --- /dev/null +++ b/pandas/.ipynb_checkpoints/Untitled2-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/pandas/Untitled1.ipynb b/pandas/Untitled1.ipynb new file mode 100644 index 0000000..dcdc15b --- /dev/null +++ b/pandas/Untitled1.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "module 'pandas' has no attribute 'csv_read'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcsv_read\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'vgsales.csv'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m: module 'pandas' has no attribute 'csv_read'" + ] + } + ], + "source": [ + "df = pd.csv_read('vgsales.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/pandas/Untitled2.ipynb b/pandas/Untitled2.ipynb new file mode 100644 index 0000000..83520b2 --- /dev/null +++ b/pandas/Untitled2.ipynb @@ -0,0 +1,278 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "df = pd.read_csv('E:/python/pandas/vgsales.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Rank Name Platform \\\n", + "0 1 Wii Sports Wii \n", + "1 2 Super Mario Bros. NES \n", + "2 3 Mario Kart Wii Wii \n", + "3 4 Wii Sports Resort Wii \n", + "4 5 Pokemon Red/Pokemon Blue GB \n", + "5 6 Tetris GB \n", + "6 7 New Super Mario Bros. DS \n", + "7 8 Wii Play Wii \n", + "8 9 New Super Mario Bros. Wii Wii \n", + "9 10 Duck Hunt NES \n", + "10 11 Nintendogs DS \n", + "11 12 Mario Kart DS DS \n", + "12 13 Pokemon Gold/Pokemon Silver GB \n", + "13 14 Wii Fit Wii \n", + "14 15 Wii Fit Plus Wii \n", + "15 16 Kinect Adventures! X360 \n", + "16 17 Grand Theft Auto V PS3 \n", + "17 18 Grand Theft Auto: San Andreas PS2 \n", + "18 19 Super Mario World SNES \n", + "19 20 Brain Age: Train Your Brain in Minutes a Day DS \n", + "20 21 Pokemon Diamond/Pokemon Pearl DS \n", + "21 22 Super Mario Land GB \n", + "22 23 Super Mario Bros. 3 NES \n", + "23 24 Grand Theft Auto V X360 \n", + "24 25 Grand Theft Auto: Vice City PS2 \n", + "25 26 Pokemon Ruby/Pokemon Sapphire GBA \n", + "26 27 Pokemon Black/Pokemon White DS \n", + "27 28 Brain Age 2: More Training in Minutes a Day DS \n", + "28 29 Gran Turismo 3: A-Spec PS2 \n", + "29 30 Call of Duty: Modern Warfare 3 X360 \n", + "... ... ... ... \n", + "16568 16571 XI Coliseum PSP \n", + "16569 16572 Resident Evil 4 HD XOne \n", + "16570 16573 Farming 2017 - The Simulation PS4 \n", + "16571 16574 Grisaia no Kajitsu: La Fruit de la Grisaia PSP \n", + "16572 16575 Scarlett: Nichijou no Kyoukaisen PS2 \n", + "16573 16576 Mini Desktop Racing Wii \n", + "16574 16577 Yattaman Wii: BikkuriDokkiri Machine de Mou Ra... Wii \n", + "16575 16578 Neo Angelique Special PSP \n", + "16576 16579 Rugby Challenge 3 XOne \n", + "16577 16580 Damnation PC \n", + "16578 16581 Outdoors Unleashed: Africa 3D 3DS \n", + "16579 16582 PGA European Tour N64 \n", + "16580 16583 Real Rode PS2 \n", + "16581 16584 Fit & Fun Wii \n", + "16582 16585 Planet Monsters GBA \n", + "16583 16586 Carmageddon 64 N64 \n", + "16584 16587 Bust-A-Move 3000 GC \n", + "16585 16588 Breach PC \n", + "16586 16589 Secret Files 2: Puritas Cordis DS \n", + "16587 16590 Mezase!! Tsuri Master DS DS \n", + "16588 16591 Mega Brain Boost DS \n", + "16589 16592 Chou Ezaru wa Akai Hana: Koi wa Tsuki ni Shiru... PSV \n", + "16590 16593 Eiyuu Densetsu: Sora no Kiseki Material Collec... PSP \n", + "16591 16594 Myst IV: Revelation PC \n", + "16592 16595 Plushees DS \n", + "16593 16596 Woody Woodpecker in Crazy Castle 5 GBA \n", + "16594 16597 Men in Black II: Alien Escape GC \n", + "16595 16598 SCORE International Baja 1000: The Official Game PS2 \n", + "16596 16599 Know How 2 DS \n", + "16597 16600 Spirits & Spells GBA \n", + "\n", + " Year Genre Publisher NA_Sales EU_Sales \\\n", + "0 2006.0 Sports Nintendo 41.49 29.02 \n", + "1 1985.0 Platform Nintendo 29.08 3.58 \n", + "2 2008.0 Racing Nintendo 15.85 12.88 \n", + "3 2009.0 Sports Nintendo 15.75 11.01 \n", + "4 1996.0 Role-Playing Nintendo 11.27 8.89 \n", + "5 1989.0 Puzzle Nintendo 23.20 2.26 \n", + "6 2006.0 Platform Nintendo 11.38 9.23 \n", + "7 2006.0 Misc Nintendo 14.03 9.20 \n", + "8 2009.0 Platform Nintendo 14.59 7.06 \n", + "9 1984.0 Shooter Nintendo 26.93 0.63 \n", + "10 2005.0 Simulation Nintendo 9.07 11.00 \n", + "11 2005.0 Racing Nintendo 9.81 7.57 \n", + "12 1999.0 Role-Playing Nintendo 9.00 6.18 \n", + "13 2007.0 Sports Nintendo 8.94 8.03 \n", + "14 2009.0 Sports Nintendo 9.09 8.59 \n", + "15 2010.0 Misc Microsoft Game Studios 14.97 4.94 \n", + "16 2013.0 Action Take-Two Interactive 7.01 9.27 \n", + "17 2004.0 Action Take-Two Interactive 9.43 0.40 \n", + "18 1990.0 Platform Nintendo 12.78 3.75 \n", + "19 2005.0 Misc Nintendo 4.75 9.26 \n", + "20 2006.0 Role-Playing Nintendo 6.42 4.52 \n", + "21 1989.0 Platform Nintendo 10.83 2.71 \n", + "22 1988.0 Platform Nintendo 9.54 3.44 \n", + "23 2013.0 Action Take-Two Interactive 9.63 5.31 \n", + "24 2002.0 Action Take-Two Interactive 8.41 5.49 \n", + "25 2002.0 Role-Playing Nintendo 6.06 3.90 \n", + "26 2010.0 Role-Playing Nintendo 5.57 3.28 \n", + "27 2005.0 Puzzle Nintendo 3.44 5.36 \n", + "28 2001.0 Racing Sony Computer Entertainment 6.85 5.09 \n", + "29 2011.0 Shooter Activision 9.03 4.28 \n", + "... ... ... ... ... ... \n", + "16568 2006.0 Puzzle Sony Computer Entertainment 0.00 0.00 \n", + "16569 2016.0 Shooter Capcom 0.01 0.00 \n", + "16570 2016.0 Simulation UIG Entertainment 0.00 0.01 \n", + "16571 2013.0 Adventure Prototype 0.00 0.00 \n", + "16572 2008.0 Adventure Kadokawa Shoten 0.00 0.00 \n", + "16573 2007.0 Racing Popcorn Arcade 0.01 0.00 \n", + "16574 2008.0 Racing Takara Tomy 0.00 0.00 \n", + "16575 2008.0 Adventure Tecmo Koei 0.00 0.00 \n", + "16576 2016.0 Sports Alternative Software 0.00 0.01 \n", + "16577 2009.0 Shooter Codemasters 0.00 0.01 \n", + "16578 2011.0 Sports Mastiff 0.01 0.00 \n", + "16579 2000.0 Sports Infogrames 0.01 0.00 \n", + "16580 2008.0 Adventure Kadokawa Shoten 0.00 0.00 \n", + "16581 2011.0 Sports Unknown 0.00 0.01 \n", + "16582 2001.0 Action Titus 0.01 0.00 \n", + "16583 1999.0 Action Virgin Interactive 0.01 0.00 \n", + "16584 2003.0 Puzzle Ubisoft 0.01 0.00 \n", + "16585 2011.0 Shooter Destineer 0.01 0.00 \n", + "16586 2009.0 Adventure Deep Silver 0.00 0.01 \n", + "16587 2009.0 Sports Hudson Soft 0.00 0.00 \n", + "16588 2008.0 Puzzle Majesco Entertainment 0.01 0.00 \n", + "16589 2016.0 Action dramatic create 0.00 0.00 \n", + "16590 2007.0 Role-Playing Falcom Corporation 0.00 0.00 \n", + "16591 2004.0 Adventure Ubisoft 0.01 0.00 \n", + "16592 2008.0 Simulation Destineer 0.01 0.00 \n", + "16593 2002.0 Platform Kemco 0.01 0.00 \n", + "16594 2003.0 Shooter Infogrames 0.01 0.00 \n", + "16595 2008.0 Racing Activision 0.00 0.00 \n", + "16596 2010.0 Puzzle 7G//AMES 0.00 0.01 \n", + "16597 2003.0 Platform Wanadoo 0.01 0.00 \n", + "\n", + " JP_Sales Other_Sales Global_Sales \n", + "0 3.77 8.46 82.74 \n", + "1 6.81 0.77 40.24 \n", + "2 3.79 3.31 35.82 \n", + "3 3.28 2.96 33.00 \n", + "4 10.22 1.00 31.37 \n", + "5 4.22 0.58 30.26 \n", + "6 6.50 2.90 30.01 \n", + "7 2.93 2.85 29.02 \n", + "8 4.70 2.26 28.62 \n", + "9 0.28 0.47 28.31 \n", + "10 1.93 2.75 24.76 \n", + "11 4.13 1.92 23.42 \n", + "12 7.20 0.71 23.10 \n", + "13 3.60 2.15 22.72 \n", + "14 2.53 1.79 22.00 \n", + "15 0.24 1.67 21.82 \n", + "16 0.97 4.14 21.40 \n", + "17 0.41 10.57 20.81 \n", + "18 3.54 0.55 20.61 \n", + "19 4.16 2.05 20.22 \n", + "20 6.04 1.37 18.36 \n", + "21 4.18 0.42 18.14 \n", + "22 3.84 0.46 17.28 \n", + "23 0.06 1.38 16.38 \n", + "24 0.47 1.78 16.15 \n", + "25 5.38 0.50 15.85 \n", + "26 5.65 0.82 15.32 \n", + "27 5.32 1.18 15.30 \n", + "28 1.87 1.16 14.98 \n", + "29 0.13 1.32 14.76 \n", + "... ... ... ... \n", + "16568 0.01 0.00 0.01 \n", + "16569 0.00 0.00 0.01 \n", + "16570 0.00 0.00 0.01 \n", + "16571 0.01 0.00 0.01 \n", + "16572 0.01 0.00 0.01 \n", + "16573 0.00 0.00 0.01 \n", + "16574 0.01 0.00 0.01 \n", + "16575 0.01 0.00 0.01 \n", + "16576 0.00 0.00 0.01 \n", + "16577 0.00 0.00 0.01 \n", + "16578 0.00 0.00 0.01 \n", + "16579 0.00 0.00 0.01 \n", + "16580 0.01 0.00 0.01 \n", + "16581 0.00 0.00 0.01 \n", + "16582 0.00 0.00 0.01 \n", + "16583 0.00 0.00 0.01 \n", + "16584 0.00 0.00 0.01 \n", + "16585 0.00 0.00 0.01 \n", + "16586 0.00 0.00 0.01 \n", + "16587 0.01 0.00 0.01 \n", + "16588 0.00 0.00 0.01 \n", + "16589 0.01 0.00 0.01 \n", + "16590 0.01 0.00 0.01 \n", + "16591 0.00 0.00 0.01 \n", + "16592 0.00 0.00 0.01 \n", + "16593 0.00 0.00 0.01 \n", + "16594 0.00 0.00 0.01 \n", + "16595 0.00 0.00 0.01 \n", + "16596 0.00 0.00 0.01 \n", + "16597 0.00 0.00 0.01 \n", + "\n", + "[16598 rows x 11 columns]\n" + ] + } + ], + "source": [ + "print(df)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'DataFrame' object has no attribute 'header'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mheader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;32mc:\\python37\\lib\\site-packages\\pandas\\core\\generic.py\u001b[0m in \u001b[0;36m__getattr__\u001b[1;34m(self, name)\u001b[0m\n\u001b[0;32m 5065\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_info_axis\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_can_hold_identifiers_and_holds_name\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5066\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 5067\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mobject\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__getattribute__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 5068\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5069\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__setattr__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mAttributeError\u001b[0m: 'DataFrame' object has no attribute 'header'" + ] + } + ], + "source": [ + "df.header()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/pandas/p1.py b/pandas/p1.py index d9c621e..f8f67a1 100644 --- a/pandas/p1.py +++ b/pandas/p1.py @@ -1,3 +1,3 @@ import pandas as pd -df = pd.read_csv('US_Accidents_May19.csv') +df = pd.read_csv('E:/python/pandas/vgsales.csv') print(df) diff --git a/websites.py b/websites.py index 67b4eaa..7125d28 100644 --- a/websites.py +++ b/websites.py @@ -1,8 +1,9 @@ # !python36 -import webbrowser +import webbrowser as wb -webbrowser.open_new_tab("http://www.binarynote.com") -webbrowser.open_new_tab("https://www.clickbank.com") -webbrowser.open_new_tab("https://account.shareasale.com/a-login.cfm?") -webbrowser.open_new_tab("https://themeforest.net/") -webbrowser.open_new_tab("https://automatetheboringstuff.com") + +wb.open_new_tab("http://www.binarynote.com") +wb.open_new_tab("https://www.clickbank.com") +wb.open_new_tab("https://account.shareasale.com/a-login.cfm?") +wb.open_new_tab("https://themeforest.net/") +wb.open_new_tab("https://automatetheboringstuff.com")