Pyspark unlist rdd - pyspark

I have a rdd with the following structure: [int,[list]]
In [109]: rdd_dummies2.take(2)
[[0, [False, False, False, False, False, False, False, False, False, False]],
[1, [False, False, False, False, False, False, False, False, False, False]]]
I would like to have another rdd with the int and the list in the same list.
I mean, something like this:
[[0,False, False, False, False, False, False, False, False, False, False],
[1,False, False, False, False, False, False, False, False, False, False]]
I tried this:
In [110]: rdd_dummies2 = rdd_dummies.flatMap(lambda x: x)
In [112]: rdd_dummies2.take(2)
Out[112]: [0, [False, False, False, False, False, False, False, False, False, False]]
but it doesn't return what I want.
Does anybody know how to use .map() or .flatMap() properly to do it?
Thank you!

You simply need to map over the rdd and prepend the first element to the list:
rdd = sc.parallelize([[0, [False, False, False, False, False, False, False, False, False, False]], [1, [False, False, False, False, False, False, False, False, False, False]]])
rdd.map(lambda x: [x[0]] + x[1]).collect()
# [[0, False, False, False, False, False, False, False, False, False, False],
# [1, False, False, False, False, False, False, False, False, False, False]]

Related

my mui dataTable in not responsive yet iam using FLEX 1;

const columns = [
{ field: 'id', headerName: 'ID', },
{
field: 'moduleName',
headerName: 'Module Name',
flex: 1,
editable: false,
sortable: false,
filter: false,
hideable: false
},
{
field: 'moduleCode',
headerName: 'Module Code',
flex:1,
align: "left",
editable: false,
sortable: false,
},
{
field: 'moduleType',
headerName: 'Module Type',
type: 'number',
flex: 1,
sortable: false,
editable: false,
align: "left",
headerAlign: 'left'
},
{
field: 'yearOfStudy',
headerName: 'Year of Study',
type: 'number',
flrx: 1,
sortable: false,
editable: false,
align: "left",
headerAlign: 'left'
},
{
field: 'program',
headerName: 'program',
type: 'number',
flex: 1,
sortable: false,
editable: false,
align: "left",
headerAlign: 'left'
},
{
field: 'programCode',
headerName: 'Program Code',
type: 'number',
flex: 1,
sortable: false,
editable: false,
align: "left",
headerAlign: 'left'
},
];
this is how it looks on the pc
enter image description here
now this is on mobile it is not responsive
enter image description here this mobile it is not responsive
mui datagrid by setting columns to
flex it is not responsive on mobiles phones it is just truncating the text instead of flex

I am getting weird trendline using fl_chart from flutter

How do I remove this weird trendline in flutter?
I think there might be a property I can put under the LineChart widget, but not sure what. During the initial startup, the charts don't show the trendline but after I long press on the ListTile, that's wrapped around it, the trendlines appear. Thanks in advance.
return SizedBox(
height: 30,
child: LineChart(LineChartData(
lineTouchData:
LineTouchData(enabled: false, handleBuiltInTouches: false),
minX: minMaxX['min'],
maxX: minMaxX['max'],
minY: minMaxY['min'],
maxY: minMaxY['max'],
titlesData: FlTitlesData(show: false),
gridData: FlGridData(
show: false, drawHorizontalLine: false, drawVerticalLine: false),
borderData: FlBorderData(show: false),
extraLinesData: ExtraLinesData(
extraLinesOnTop: false,
horizontalLines: [
HorizontalLine(y: widget.openPrice, color: kDisabledColor)
]),
lineBarsData: [
LineChartBarData(
isStepLineChart: false,
belowBarData: BarAreaData(
show: true,
colors: [chartColor.withOpacity(0.4)],
),
colors: [chartColor],
isCurved: false,
dotData: FlDotData(show: false),
spots: chartDataPoints
.map((point) => FlSpot(point['x'], point['y']))
.toList()),
])),
);

Flutter FLCharts Grid not rendering correctly

I am showing a chart in my Flutter App using fl_chart library.
I am trying to show spots with an y value of either 1, 2, or 3 and I want to draw a horizontal line on the chart on the values 1, 2 and 3.
Here is my code:
class MyChart extends StatelessWidget {
final List<ScatterSpot> spots;
const MyChart({
Key? key,
required this.spots,
}) : super(key: key);
#override
Widget build(BuildContext context) {
return ScatterChart(
ScatterChartData(
minX: 1,
maxX: 5,
minY: 1,
maxY: 3,
scatterSpots: spots,
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
drawVerticalLine: false,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.grey.shade300,
strokeWidth: 1,
);
},
horizontalInterval: 1,
),
borderData: FlBorderData(
show: false,
),
titlesData: FlTitlesData(
leftTitles: SideTitles(
showTitles: true,
getTitles: (value) => value.toString(),
interval: 1,
),
rightTitles: SideTitles(
showTitles: false,
),
topTitles: SideTitles(
showTitles: false,
),
bottomTitles: SideTitles(
showTitles: false,
),
),
),
);
}
}
So, as you can see, I have defined a minY Value of 1 and a maxY Value of 3. I am drawing a horizontal line with an Interval of 1. The Titles on the y-axis are shown correctly for 1, 2 and 3, but the line is only drawn for the value 2, not for the values 1 and 3. How can I fix this?
Fixed it ^^
I just set borderData with bottom and top BorderSide

in angular-ag-grid, how to add vertical line/separator on specific column headers only?

I am trying to add vertical separator only to Main Header columns - 'Main-H-Col2' and 'Main-H-Col3' and not on sub column headers. How to achieve this ?
export const TestAgGridColumns = [
{headerName: 'Col1', field: 'col1', sortable: true, filter: true, lockVisible: true, lockPosition:
true, editable: false},
{headerName: 'Main-H-Col2',
children: [
{ headerName: 'sub-H-Col2',
field: 'sub-H-Col2',
sortable: true,
filter: true,
lockVisible: true,
lockPosition: true,
cellRenderer: 'agCellRenderer',
cellEditor: 'agSelectCellEditor',
cellEditorParams: {
values: ['Y', 'N'],
cellRenderer: 'agCellRenderer',
}
}
]},
{headerName: 'Main-H-Col3',
children: [
{ headerName: 'sub-H-col3-1', field: 'sub-H-col3-1', sortable: true, filter: true, lockVisible:
true, lockPosition: true,
cellRenderer: 'agCellRenderer',
cellEditor: 'agSelectCellEditor',
cellEditorParams: {
values: ['Y', 'N'],
cellRenderer: 'agCellRenderer',
}
},
{ headerName: 'sub-H-col3-2', field: 'sub-H-col3-2', sortable: true, filter: true, lockVisible:
true, lockPosition: true},
{ headerName: 'sub-H-col3-2', field: 'sub-H-col3-2', sortable: true, filter: true,
lockVisible: true, lockPosition: true, editable: false,
tooltipField: 'sub-H-col3-1Changes',
tooltipComponentParams: { color: '#ececec' }}
]}
];

Win32 batch scripts always fail pgAgent

PostgreSQL batch script always fail not running.
below job script query....
DO $$ DECLARE
jid integer;
scid integer; BEGIN
-- Creating a new job INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled ) VALUES (
1::integer, 'Execute_batch002'::text, ''::text, ''::text, true ) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL) INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc ) VALUES (
jid, 'Action1'::text, true, 'b'::character(1),
''::text, ''::name, 'f'::character(1),
'C:\Script\Test_backup.bat'::text, ''::text ) ;
-- Schedules
-- Inserting a schedule INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths ) VALUES (
jid, 'Sch_1'::text, ''::text, true,
'2018-03-28 00:00:01+05:30'::timestamp with time zone, '2055-07-16 00:00:01+05:30'::timestamp with time zone,
-- Minutes
ARRAY[false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false, false, false,
false, false, true, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false, false, false,
false, false]::boolean[],
-- Hours
ARRAY[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
true, true, true]::boolean[],
-- Week days
ARRAY[true, true, true, true, true, true, true]::boolean[],
-- Month days
ARRAY[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true,
false]::boolean[],
-- Months
ARRAY[true, true, true, true, true, true, true, true, true, true, true, true]::boolean[] ) RETURNING jscid INTO scid; END $$;
check below statistics of above job.
Always running and aborted status.
link_1