Categories
Mastering Development

Search and process data from multi-index DataFrames

I have two dataframes df2, with the payment statistics (that have the probability of the client pay a certain debt) and df3 with new clients data. import pandas as pd d = {‘City’: [‘Tokyo’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Lisbon’,’Lisbon’,’Lisbon’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Lisbon’,’Lisbon’,’Lisbon’,’Tokyo’,’Lisbon’,’Tokyo’], ‘Card’: [‘Visa’,’Visa’,’Master Card’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Visa’,’Master Card’], ‘Colateral’:[‘Yes’,’No’,’Yes’,’No’,’No’,’No’,’No’,’Yes’,’Yes’,’No’,’Yes’,’Yes’,’No’,’Yes’,’No’,’No’,’No’,’Yes’,’Yes’,’No’,’No’,’No’], ‘Client Number’:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22], ‘DebtPaid’:[0.8,0.1,0.5,0.30,0,0.2,0.4,1,0.60,1,0.5,0.2,0,0.3,0,0,0.2,0,0.1,0.70,0.5,0.1]} df = pd.DataFrame(data=d) df2=df.groupby([‘City’,’Card’,’Colateral’])[‘DebtPaid’].\ value_counts(bins=[-0.001,0,0.25,0.5,0.75,1,1.001,2],normalize=True) […]

Categories
Mastering Development

Why order of lines matters here?

I am creating a Memory Game and I can’t understand how can these two lines order matters in the code: const timer = setTimeout(() => { if (picks.length === 2) { //this order that works setPicks([]) setCards(cards => cards.map((c) => ({ …c, isFlipped: false }))); } }, 500) const timer = setTimeout(() => { if […]

Categories
Mastering Development

How to convert multiple columns of list of dictionary, set, tuple to columns

I have some structure and data CusID Name Shop Item Card Type Price 1 Paul Pascal [{“Food”:”001″,”Water”:”Melon”,”Dessert”:”Mango”}] [{“Main”:”Yes”, “Second”:””}] {“VIP”:”YES”} 24000 2 Mark Casio [{“Food”:”001″,”Water”:”Apple”,”Dessert”:”Mango”}] [{“Main”:””, “Second”:”Yes”}] {“VIP”:”YES”} 30800 3 Bill Nike [{“Food”:”004″,”Water”:””,”Dessert”:””}] [] {} 900 I want to split Item, Card, and Type columns. This is the expected output Name Shop Food Water Dessert […]

Categories
CMS Drupal Mastering Development

What commerce core feature or contributed module can fulfill this retail requirement?

I’m collating the resources required for a project. This system will be based on Drupal 8. I’ve done 2 D7 Commerce related systems in the past one year. It’s a retail system, customers can register, but mostly registration is done by a staff at the store location, and transactions are completed by an in-person staff. […]

Categories
Linux Mastering Development

Knowing about card reader

I have a card reader slot built-in in my laptop. I never used it with Windows. I want to know information about it but I can not find any mention about in hwinfo, lshw and lspci . Is there any way to know about it ?? Note: Even it is mentioned, I couldn’t find it. […]

Categories
CMS Mastering Development Wordpress

Enqueue assets from multiple directories using add_action/do_action

I might not be using the actions correctly, but I think they work for my idea? Maybe? I’m trying to enqueue js and css from various directories based on do_actions. To simplify my setup and to make this easier to explain: Root: assets css global.css js global.js functions.php components card script.js style.css card.php teaser script.js […]

Categories
Mastering Development

Stripe: How do I add and store additional form elements with javascript?

I am trying store data from additional inputs in the form, not just the credit card information. Here is what the form looks like: form image The payment works and the booking gets stored in the database. I am struggling to figure out how to also get the additional form inputs “a link to your […]

Categories
Mastering Development

Why ReactJs says the link or path is broken when I put it in Card.img#src?

I’m using ReactJs-bootstrap and I have a Card that has image inside of it. inside the Card there is <Card.Img> tag that I imported form ReactJs-bootstrap. the Card.Img there has attribute ‘src’. when I try to change the ‘src’ it does the broken picture as if the path is wrong. I tried to search for […]

Categories
Mastering Development

Unable to create constant variables in React.js

I am trying to create constants in react as follows: const [firstFocus, setFirstFocus] = React.useState(false); const [lastFocus, setLastFocus] = React.useState(false); The constants are being used in the code as follows: import React, { Component } from ‘react’ import axios from ‘axios’ import { Button, Card, CardHeader, CardBody, CardFooter, Form, Input, InputGroupAddon, InputGroupText, InputGroup, Container, Col […]

Categories
Mastering Development

Cross-Origin Request Blocked when requesting Paypal sandbox but a different localhost port works fine

I’m having trouble understanding why I’m getting a Cross-Origin Request Blocked error when trying to send a user in my app to a sandbox.paypal.com payment page when ordering a product. The frontend of my app (with React) uses localhost port 3000 while the backend uses localhost port 4000. The communication between the two ports when […]