Posts

Showing posts from 2017

Dream of fear

Image
Yesterday, I saw a long dream. I don't know what my biggest fear is but, that was one of the scariest dream I have seen in long time. I don't usually dream and I have stopped dreaming even in the day(I am not a day dreamer anymore). Anyway, I realized that I don't fear death. I may feel pain and I may cry, I may worry about nearones, I may fear uncertainty but there is a good chance that I am not that much afraid of death. But, I was always fond of respect or image. In my dream, I had lost respect and image, love from nearones but I realized that you don't die from such losses. The dream supported nihilistic philosophy. It does not matter much, no matter what you do. That's why there are so many kinds of people and they still manage to not matter much. "There are so many types of people in the world and yet, they manage to not matter much." Therefore, never ever think that you can't live without something or someone. Because, You can and you wi

Filipino or Tagalog

Magandang gabi - Good Evening kabayam, ka - friend mahal - love mahal kita - I love you matalina - smart maganda - beautiful tulog - sleep putik - mud bakit - why?

Python data beautifulsoup

Beautifulsoup findAll(tag, attributes, recursive, text, limit, keywords) find(tag, attributes, recursive, text, keywords) .findAll({"h1","h2","h3","h4","h5","h6"}) .findAll("span", {"class":"green", "class":"red"}) .findAll(text="the prince") .findAll(id="text") Both are same bsObj.findAll(id="text") bsObj.findAll("", {"id":"text"}) Both are same bsObj.findAll(class_="green") bsObj.findAll("", {"class":"green"}) from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://www.pythonscraping.com/pages/page3.html") bsObj = BeautifulSoup(html) for child in bsObj.find("table",{"id":"giftList"}).children:     print(child) from urllib.request import urlopen from bs4 import BeautifulSoup html

Japanese words (will be updated later)

Konnichiwa - Hello sayonara - bye arigato - thank you baka - idiot hai - yes iie - no gommenasai - sorry matane - see you later oyasumi - good night ikou - let's go chaousi wadou - what's up? kudasai - please kampai - bottom's up watashi - I anata - you da me - oh no

Korean words (will be update later)

Shiro - Don't (do that) Kaamchakiya - That surprised me Anyong - Hello ye - yes aanio - no na - I ne - my dangsin - you dangsine - your hwanyong haeyo - welcome butak habnida - Please mian haeyo - sorry goma woyo - thanks gapsida - let's go hapsida - let's do it khambe - bottom's up fighting - for cheering urpose ottoke - how? yojim ottoke jineyo? - How are you? nappun - bad najunge - later najungewoyo - see you later irumin boya? - what's your name? busshun ireyo?  - what happened? yerobun - everyone

Pandas and list compare

import numpy as np import pandas as pd df = pd.DataFrame({'List1':[1,2,3, 4,5,5,11,4],'List 2':[3,5,6,8,9,3,4,9]}, columns=['List1', 'List 2']) #df.to_excel("list1.xlsx", header=True, index=False) df['Intersect']=pd.DataFrame( np.intersect1d(df['List1'], df['List 2'])) #unique common in both df['commonin1']=df['List1'][ np.in1d(df['List1'], df['List 2'])] #non unique common items of list 1 df['commonin2']=df['List 2'][np.in1d(df['List 2'], df['List1'])] #non unique common items of list 2 df['1not2']=pd.DataFrame(np. setdiff1d(df['List1'], df['List 2'])) #in list1 but not in list 2 df['2not1']=pd.DataFrame(np. setdiff1d(df['List 2'], df['List1'])) #in list 2 but not in list1 df['1not2NU']=df['List1'][~np. in1d(df['List1'], df['List 2'])] #in list1 but not in list 2 non unique d

Pandas snips

https://gist.github.com/gauravmeena0708/78770ccffb0e008cf25b0261e47fb7d8   https://gist.github.com/gauravmeena0708/71a64e34a8e1a0e49927a288cfb3d7a8   https://gist.github.com/gauravmeena0708/4f3e6c1009dec4446ff93ac011be26cf   data = 'a,b,c \n 1,2,3 \n 4,5,6 \n 7,8,9' pd . read_csv ( StringIO ( data ), names = [ 'foo' , 'bar' , 'baz' ], header = 0 )   data = 'skip this skip it \n a,b,c \n 1,2,3 \n 4,5,6 \n 7,8,9' pd . read_csv ( StringIO ( data ), header = 1 )   pd . read_csv ( StringIO ( data ), usecols = [ 'b' , 'c' ]) pd . read_csv ( StringIO ( data ), usecols = [ 0 , 2 , 3 ]) pd . read_csv ( StringIO ( data ), usecols = lambda x : x not in [ 'a' , 'c' ])     data = ' \n a,b,c \n \n # commented line \n 1,2,3 \n\n 4,5,6' pd . read_csv ( StringIO ( data ), comment = '#' )       data = 'a,b,c \n\n 1,2,3 \n\n\n 4,5,6' pd . read_csv ( StringIO

Batch rename and xls to csv

''' #Remove spaces from filename import os path = 'C:\\Users\\gaura\\Downloads\\estmst' #os.getcwd() filenames = os.listdir() for filename in filenames: os.rename(os.path.join(path, filename), os.path.join(path, filename.replace(' ', '-'))) ''' import os , pandas as pd path = 'C: \\ Users \\ gaura \\ Downloads \\ estmst' for filename in os . listdir(path): data_xls = pd . read_excel(filename, 'Main Dashboard Excel' , index_col = None ) data_xls . to_csv(filename + '.csv' , encoding = 'utf-8' , index = False )

Merge multiple xls files

Compiled from various sources on internet 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 import os , pandas as pd # filenames excel_names = [] for filename in os . listdir( '<Dir path' ): if filename . endswith( '.xls' ): excel_names . append(filename) excels = [] for name in excel_names: try : excels . append(pd . ExcelFile(os . path . join( ' ' , name))) except IndexError : print (name) # turn them into dataframes frames = [x . parse(x . sheet_names[ 0 ], header = None ,index_col = None ) for x in excels] # delete the first row for all frames except the first # i.e. remove the header row -- assumes it's the first frames[ 1 :] = [df[ 1 :] for df in frames[ 1 :]] # concatenate them.. combined = pd . concat(frames) # write it out combined . to_excel( "c.xlsx" , header = False , index = False )

iMacros for automating browsers

Automate clicks and other activities using iMacros Sample code ONDOWNLOAD FOLDER=* FILE=* WAIT=YES TAG POS=10 TYPE=INPUT:SUBMIT FORM=ACTION:post.php ATTR=NAME:415 ONDOWNLOAD FOLDER=* FILE=* WAIT=YES TAG POS=11 TYPE=INPUT:SUBMIT FORM=ACTION:post.php ATTR=NAME:415 ONDOWNLOAD FOLDER=* FILE=* WAIT=YES TAG POS=12 TYPE=INPUT:SUBMIT FORM=ACTION:post.php ATTR=NAME:415 ONDOWNLOAD FOLDER=* FILE=* WAIT=YES or Just record a macro and edit it to your requirements

Summary

C7 1. sec 32 of CPC 2. issue a warrant of arrest 3. attach and sell his property 4. impose a fine lt 5000 5. order to furnish security for presence 6. Summon to witness 7. Attachment of Bank 8. Show cause D 1. Call 2. Notice 3. For small amount RFO early 4. Bank Attachment R 1. Cp-1 notice 2. 8f 3. 8(3) 4. CP-25 show cause to arrect warrant 5. Cp -26 Arrest Warrant 6. Attach movable property 7. Attach Immovable property http://epfoa.in/rules/rules.html

Irrational Behaviour Part 2 Dan Ariely

3.7 Market and Social norm     We can't judge social work on money     people will help for free than to get $3 for change of tires     If we pay nothing willingness to help is more     if we pay less    willingness to help is less     If we pay more    willingness to help increases again     Gifts? even if they cost less, people are not offended     with cash they are offended even if it is efficient method       late parent at day care centre -> fine for being late -> they are now more late     now they tried to remove fine but this was hard as market was already set       eg: two insurance companies, one fully formal but other builts social relationships     if both levy a fine w/o giving you any scope to mend, you will be more angry at second.     therefor build relationships only if you can keep their norms     if not it is better to not build relationship     similarly, vague contracts such as marriage are much better than constitutional law 3.8 Th

Irrational Behaviour Part 1

2.1 Nurse example, we assume we are right     ipad red count-bee suit professor example 2.2 Defaults     Organ donation - UK-France, Sweden-Denmark Default yes     we take the path of least resistance     default have big value     we create stories to justify our actions     Generic vs branded medicine     People do not want to do something different, even if they are minor and better     be aware of defaults     6 jam and 24 jams in supermarket     the path of least resistance 2.3 Preference depend on environment     3 reasons to like thing - show more confidence     10 reasons to like thing - less confident     conclusions:you can like/love with one reason or no reason 2.4 How often do you floss your teeth     two scale 0 to >9 per month feel good, and 0 to >9 per day feel bad ->affects immediate decisions     so if you want to get people subscribed give them similar test     if you want someone to take risk -> ask to assume if had huge money what wou

Hindi Poem (हिंदी कविता ) - 21: Some of my favorites

Image
लिखा हुआ हर एक शब्द काल्पनिक है | इसका किसी भी व्यक्ति या वस्तु से वास्तविक सम्बन्ध नहीं है | अगर किसी व्यक्ति का इससे कोई वास्तविक सम्बन्ध पाया जाता है तो यह मात्र एक संयोग होगा | स्वार्थ बस इतना मांगता हूँ मैं जो भी करू खुश रहू मेरा परिवार खुश रहे मेरा देश प्रसंनित हो और संसार खुश रहे मेरा भला हो मेरे परिवार का भला हो भला हो देश का ये संसार फूले फले ========================================================================= कल कल किसी कहानी में समाज का चेहरा दिखेगा नहीं कोई कथाकार ऐसी शक्ल बुनेगा नहीं क्योंकि - वह इतना जान लेगा कि डरने लग गया है इन्सां अपने अक्स से अपने बिम्ब से वह स्वंयं को जानना चाहेगा नहीं और वह जियेगा सपनो में जागेगा नहीं ========================================================================= भावनाएं मैं या तो नहीं करता तुम्हारी परवाह; गर करता भी तो नहीं है व्यक्त करने की चाह; मुझे यकीं नहीं किसी पर भी ना तुम पर, ना अपने आप पर भी; पर इतना कह सकता हूँ मांगोगी तो - ये हस्ती है तेरे लिए ये मुस्कान तुम्हारी है, ये

Hindi Poem (हिंदी कविता ) - 22: कुछ शब्द जो अधूरे रह गए -2

भाग दौड़ भरे इस दौर में बचपन एवं बाल श्रम पर कुछ शब्द - फूल खिले है शाखों पर समां ज़रा महकाने दो मुरझाना भी जीवन है  पर पतझर को तो आने दो  - गौरव --------------------------------------------- कुछ ख्वाब के धागों से पिरोई जिंदगी है कुछ सागर के मोती सी संजोई जिंदगी है एक एक पल ख़ुशी का बटोर लेना खुद से वर्ना बुलबुलों की मानिंद खोई जिंदगी है - Gaurav --------------------------------------------- हम कभी तेरे हम दम ना थे ना कभी देखा था ख्वाब होने का फिर जालिम क्यों इलज़ाम लगाया मयकदे में तिर होने का - Gaurav --------------------------------------------- हाल तो ऐसे पूछती है वो जैसे कई दिनों से हंसने का बहाना नहीं मिला और हम है कि जीते जाते है जैसे जिंदगी में एक जमाना नहीं मिला - Gaurav -------------------------------------------- यूँ तो हम तुमसे अक्सर नज़र फेर लेते थे दिल के पंछी को हम ख्वाबो में पंख देते थे | वो तो बरसात ने किरकिरा कर दिया मौसमहम तो रेगिस्तां में नैय्या बहुत खेते थे  - Gaurav ----------------------------------------------- Prosopagno